I use the thinkphp version is 3.2.3, this version of the earlier version of the call method is not the same, the correct way to call is:
Demo3controller.class
<?phpnamespace Home\controller; UseThink\controller;classDemo3controllerextendsController { Public functionDownload () {$url= "Http://n.sinaimg.cn/sports/20161023/MrD2-fxwztrt0212622.jpg"; $LOCALURL= "Public/bookcover/mrd2-fxwztrt0212622.jpg"; $http=New\org\net\http (); $http->curldownload ($url,$LOCALURL); Echo"Saved successfully"; } }
$url is the remote address of the server
$LOCALURL is the local server address
Note here that the public/bookcover/directory does not exist, it is necessary to create a manual, or will error, the Curldownload method does not automatically create a local folder.
The pictures saved to the public directory can be accessed through http://localhost/thinkphp/Public/bookcover/MrD2-fxwztrt0212622.jpg.
Download pictures on the network to the local server using thinkphp