PHP access to network shared resources and local files

Source: Internet
Author: User
PHP access to network shared resources and local files


The company banned the net, but my work needs external network, so can only use the company's public computer. Use your own computer to remotely manipulate him (in fact, you can get an agent, but not in this way). So some files are on the public machine above, however, because I am more lazy, do not want to test to go, so the use of the folder will be accessed, set to share, and then access with PHP access.

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 is implemented by reading the size of the 1.png file under the shared Pic_gather/figure path under the public computer.

Note that the diagonal bar here can only be used "/" otherwise the access is unsuccessful. It's also best to do this so that your code is compatible with Linux.

To access local resources, the code 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;? >


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.