Home >Backend Development >PHP Tutorial >The easiest way to download images via url in php.
<?php
$url ='http://mmbiz.qpic.cn/mmbiz/PGkxayImcuhpTfGWiagtAY1R8L7C1licueqssxnJSJJntscaUrK6vAiakqo4RXdv2bud2ic3YicVbvIghLFhGc5ByyA/0'; file_put_contents('aaa.jpg', file_get_contents($url));
?>
If you want to download to the specified /www/uplods path, just replace aaa.jpg with /www/uploads/aaa.jpg
The premise is that the directory is writable, you can use chmod 755 /www/uploads
The above introduces the simplest method in PHP to download images through URL. , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.