0
我有一個每天運行的自動調度作業。不讓我用file_put_contents創建一個空文件
$i = 0;
for ($i = 0; $i < count($array1); $i++) {
file_put_contents('outfile.txt', $array1[$i]."\t".$array2[$i]);
}
但是在某些日子裏$array1
是空的。當它爲空時,file_put_contents
根本不生成文件並中斷了我的整個預定管道作業。我怎樣才能使file_put_contents
仍然生成一個空的outfile.txt作爲我的管道的一部分?
'if(empty($ array1)){...}' – 2013-08-23 01:06:46
這是for循環之前嗎? – user1899415
而不是'file_put_contents'嘗試'fopen','fwrite','fclose'。 – 2013-08-23 01:08:39