Excuse me, where did I write something wrong?
<code>$txt = "R:/1.txt"; date_default_timezone_set("PRC"); fOpen( $txt ,"a+" ); for($i=0;$i<10 ;$i++) { $str = date("Y-m-d H:i:s",Time()); sleep(2); fwrite( $txt , $str ); } fClose( $txt ); </code>
Excuse me, where did I write something wrong?
<code>$txt = "R:/1.txt"; date_default_timezone_set("PRC"); fOpen( $txt ,"a+" ); for($i=0;$i<10 ;$i++) { $str = date("Y-m-d H:i:s",Time()); sleep(2); fwrite( $txt , $str ); } fClose( $txt ); </code>
Um, the first parameter of fwrite
is the file handle. What you are passing here is a path
<code class="php"> $txt = "R:/1.txt"; date_default_timezone_set("PRC"); //打開文件返回一個文件句柄, $headle = fopen( $txt ,"a+" ); for($i=0;$i<10 ;$i++) { $str = date("Y-m-d H:i:s",time()); sleep(2); fwrite($headle , $str ); } fClose( $txt ); </code>