PHP获取远程图片代码示例:
- function gethttpimage($url){
- set_time_limit(0);
- if(!empty($url)){
-
$imgUrl=date('Y-m',time()).'/'.
uniqid().strrchr($url,".");
-
$imgPath=APP_PATH.'/Public
/uploads/';
-
$filename=$imgPath.$imgUrl;
- if(!is_dir($imgPath)) @mkdir
($imgPath,0777); -
$get_file=@file_get_
contents($url);
- if($get_file){
-
$fp=@fopen($filename,"w");
- @fwrite($fp,$get_file);
- @fclose($fp);
- }
- return $imgUrl;
- }else{
- return false;
- }
- }
以上这段代码就是PHP获取远程图片的相关方法介绍。
http://www.bkjia.com/PHPjc/445976.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445976.htmlTechArticlePHP获取远程图片代码示例: functiongethttpimage($url){ set_time_limit(0); if(!empty($url)){ $ imgUrl = date ('Y-m',time()).'/'. uniqid().strrchr($url,.); $ imgPath = APP_...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn