exists, is returned ture or 1 does not return FALSE or 0The file_get_contents () function reads the entire file into a string.mkdir Create directory, success Ture no falseThe file_put_contents () function writes a string to the file and calls fopen (), fwrite (), and fclose () in turn.
This procedure is the home page to determine whether we read the address is the network or local, if the picture address of the server is not processed otherwise the
Today, when we collate the information, we find a function that we have found before, through which we can implement the above function.
Main functions:
Copy the Code code as follows:
function Grabimage ($url, $filename = "") {if ($url = = "") return false;if ($filename = = "") {$ext =STRRCHR ($url, ".");if ($ext! = ". gif" $ext! = ". jpg" $ext! = ". png") return false;$filename =date ("Ymdhis"). $ext;}Ob_start ();ReadFile ($url);$img = Ob_get_contents ();Ob_end_clean ();$size = strlen ($img)
PHP Save remote server picture code
function Getmicrotime () {List ($usec, $sec) = Explode ("", Microtime ());Return ((float) $usec + (float) $sec);}
function Savehttpfile ($fFileHTTPPath, $fFileSavePath, $fFileSaveName){Log when the program started$BeginTime =getmicrotime ();
Get file name$fFileSaveName = $fFileSavePath. " /". $fFileSaveName;
Get the contents of a fileOb_start ();ReadFile ($fFileHTTPPa
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.