Heim >Backend-Entwicklung >PHP-Tutorial > 为何crontab -e不能执行fwrite写入文件?蹦溃了
为什么crontab -e不能执行fwrite写入文件?蹦溃了。
function Write_FileFun_new($filename,$filedir, $htmldata = '') {<br /> if(!is_dir($filedir)) {<br /> mkdir($filedir, 0777);<br /> }<br /> $htmlfile = $filedir.$filename;<br /> if($fp = fopen($htmlfile, 'wbt')) {<br /> fwrite($fp,$htmldata);<br /> fclose($fp);<br /> } else {<br /> echo "<center><p>Can not write to files, please check directory $htmldir.</p></center>";<br /> exit;<br /> }<br /> }<br /> $testnum_temp="<?php \$testnum = ".(intval($testnum)+1)."; ?>";<br /> Write_FileFun_new("test.php","inc/", $testnum_temp);