Click here to Skip to main content
15,887,351 members
Please Sign up or sign in to vote.
1.00/5 (1 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 5: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

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


something written after ; will always throw error.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900