简体   繁体   中英

Reliability of PHP copy() method with image file from remote server

http://php.net/manual/en/function.copy.php

Makes a copy of the file source to dest.

After conduction several tests, the PHP copy() method works fine to copy an image file from a remote server. The image file is coped from the public html directory on the remote server, where the website images exist.

Would this method be reliable in all cases? In other words, are there any known configurations that may exist on the remote server that would cause copy() to fail.

<?php copy("http://domain.com/images/file.jpg", "/local_dir/file.jpg"); ?>

cURL has been suggested but seems like overkill to perform a simple copy operation.

如果图像不可读,则可能会失败,但是由于您说的是公众可以访问的图像,因此这不是问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM