Php file operation problems & lt ;? Php $ path & quot; D: Install--Doucmentwampwwwa.txt & quot; echofilesize ($ path );? & Gt; & nbsp; the following error occurs in total for these lines of code: Warning: filesize () [function. filesize]: statfailedf php file operation problems
$ Path = "D: \ Install -- Doucment \ wamp \ www \ a.txt ";
Echo filesize ($ path );
?>
The following error occurs in a total of these lines of code:
Warning: filesize () [function. filesize]: stat failed for D: \ Install -- Doucment \ wamp \ www \ a.txt in D: \ Install -- Doucment \ wamp \ www \ Practice. php on line 4
I cannot find a similar solution on the internet. I don't know which of the following heroes knows the solution... Thank you!
------ Solution --------------------
In PHP, use dirname (_ FILE _). the path should be a backslash (/) rather than a slash \
View http://php.net/manual/zh/function.dirname.php
------ Solution --------------------
There is no other reason for path error. if the file does not exist, this prompt will appear.
You can put the test file and a.txt together to avoid errors.
$ Size = filesize ('./a. php ');
Echo $ size;
------ Solution --------------------
Discussion
$ Path = "D: \ Install -- Doucment \ wamp \ www \ a.txt ";
Echo filesize ($ path );
?>
The following error occurs in a total of these lines of code:
Warning: filesize () [function. filesize]: stat failed for D: \ Install -- Doucment \ wamp \ www \ a.txt ......