Click here to Skip to main content
14,428,725 members
Rate this:
Please Sign up or sign in to vote.
See more:
the syntax error at the line after the third $Content variable.

unexpected \ (T_NS_Seperator), expecting identifier (T_String)

What I have tried:

if($ran != 0):
		$CTcontent = "<?php\
\\r\
\\r";
		$CTcontent .= '// Set $lastrun = "never" to stop fakecon from running completely'."\
\\r\
\\r";
		$CTcontent .='$lastrun = "'.date("Y-m-d")."\\";\
\\r\
\\r?>";
		if (is_writable($crontab)):
			$handle = fopen($crontab, "w");
			if (fwrite($handle, $CTcontent) === FALSE):
						// echo only while testing
						//echo  'Fake Cron error! Could not write to '.$crontab.".\
";
						//exit;
					endif;
					fclose($handle);
				endif;					
			endif;			
		endif;
	endif; 
endif;
Posted
Updated 23-Oct-18 6:08am
Comments
Richard MacCutchan 23-Oct-18 11:15am
   
You have unbalanced quote characters in your string.
JiaWei Lee 26-Oct-18 6:47am
   
how to make the string balance? tried but failed

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

$CTcontent .='$lastrun = "'.date("Y-m-d")."\\";\
\\r\


something written after ; will always throw error.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100