I found a very strange problem. When I used fwrite
to write a file, the program did not report an error. fwrite
also returned the number of words written, but the content in the file was empty.
<code> $path = Yii::$app->basePath."/upload/tt.txt"; $file = fopen($path,'w'); fwrite($file,'aaaaa'); fclose($file);</code>
Using the Yii2.0
framework.
Try using file_put_contents
again, but still no response O__O "…
I found a very strange problem. When I used fwrite
to write a file, the program did not report an error. fwrite
also returned the number of words written, but the content in the file was empty.
<code> $path = Yii::$app->basePath."/upload/tt.txt"; $file = fopen($path,'w'); fwrite($file,'aaaaa'); fclose($file);</code>
Using the Yii2.0
framework.
Try using file_put_contents
again, but still no response O__O "…
Please check if the file has writable permissions
It feels like the writing was successful, please look for possible paths.
<code>is_writable($file) </code>
Determine write permission
But the author seems to have the wrong path
It should be that the path is written wrong. You can print out $path and have a look
Raise the error level of php and debug it
Please check whether the file encoding format conflicts.
Enter $path and confirm whether the path is correct