Php accesses internet shared resources and local files & nbsp; the company bans the Internet, but my work needs to be on the Internet, so I can only use the company's public computer. Use your computer to remotely operate on him (in fact, you can get proxy, but this method is not used ). So some files are on the public machine, but I am too lazy and don't want to test php to access network shared resources and local files.
The company has no access to the Internet, but my work needs to be on the Internet, so I can only use the company's public computer. Use your computer to remotely operate on him (in fact, you can get proxy, but this method is not used ). So some files are on the public machine, but I am too lazy to take the test, so I use the folder to be accessed, set it to share, and then access it using php.
The simple test code is as follows:
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK"> <? Php $ filename = "// 192.168.1.31/pic_gather/figure/1.png"; $ size = filesize ($ filename); echo $ size;?>
The above code reads the size of the 1.png file shared by pic_gather/figure.pdf on the public computer.
Note that only the slash "/" can be used here, otherwise the access will fail. This is also the best way to make your code compatible with linux.
The code for accessing local resources is as follows:
<Meta http-equiv = "Content-Type" content = "text/html; charset = GBK"> <? Php $ filename = "D:/pic_gather/figure/1.png"; $ size = filesize ($ filename); echo $ size;?>