I found a very strange problem. When I usedfwrite
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.
$path = Yii::$app->basePath."/upload/tt.txt"; $file = fopen($path,'w'); fwrite($file,'aaaaa'); fclose($file);
Using theYii2.0
framework.
Try usingfile_put_contents
again, but still no response O__O "…
I found a very strange problem. When I usedfwrite
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.
$path = Yii::$app->basePath."/upload/tt.txt"; $file = fopen($path,'w'); fwrite($file,'aaaaa'); fclose($file);
Using theYii2.0
framework.
Try usingfile_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.
is_writable($file)
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