Home >CMS Tutorial >Empire CMS >How to save pictures remotely in Empire CMS
The example in this article describes the method of remotely saving pictures by Empire CMS. Share it with everyone for your reference.
The specific implementation method is as follows:
The code is as follows:
<?php function get_file($url,$folder,$pic_name){ set_time_limit(24*60*60); //限制最大的执行时间 $destination_folder=$folder?$folder.'/':''; //文件下载保存目录 $newfname=$destination_folder.$pic_name;//文件PATH $file=fopen($url,'rb'); if($file){ $newf=fopen($newfname,'wb'); if($newf){ while(!feof($file)){ fwrite($newf,fread($file,1024*8),1024*8); } } if($file){ fclose($file); } if($newf){ fclose($newf); } } } get_file("http://www.baidu.com/img/baidu_logo.gif","file","baidu.jpg"); ?>
Recommended to study "Empire cms tutorial"
Supplement :
Solutions for the Imperial CMS verification code not being displayed:
When the Imperial CMS verification code is not displayed, you can try the following.
1. Re-modify the submission comment form
2. Remove all BOM headers from the page
3. Check the GD library of the server.
4. Remove the space between bb9bd6d87db7f8730c53cb084e6b4d2d and press Enter
5. Clear the server and local machine cache
6. Backup the database in the background-repair Data table - Optimization data table
I hope this article will be helpful to everyone’s Imperial CMS website building.
The above is the detailed content of How to save pictures remotely in Empire CMS. For more information, please follow other related articles on the PHP Chinese website!