[Help] $ body = ereg_replace ($ value, $ fileurl, $ body) function & nbsp; remoteimg ($ imgurl) & nbsp ;{& nbsp; & nbsp; & nbsp; import ('@. ORG. session '); // Ses [help] $ body = ereg_replace ($ value, $ fileurl, $ body) is not included in the file header)
Function remoteimg ($ imgurl ){
Import ('@. ORG. session'); // A Session is not included in the file header.
$ Mid = Session: get ('mid '); // Obtain the mid
// Path of the file storage directory
$ ImgPath = "/Uploads/$ mid". date ('ymmd'). '/files/'; // url of the current date folder
Dir_create ($ imgPath); // create this directory
// File Save Directory URL
$ ImgUrl = _ ROOT _. '/'. $ imgPath; // Obtain the root parameter value configured in the current file.
Set_time_limit (0); // The code execution time limit. if the value is 0, the program execution is complete.
$ MilliSecond = date ("dHis"). '_'; // record the current date and time score in seconds
If (! Is_dir ($ imgPath) @ mkdir ($ imgPath, 0777); // create a directory if the directory does not exist (full permission)
$ Value = trim ($ imgurl); // remove spaces at both ends of the image address
$ Get_file = @ file_get_contents ($ value); // Obtain image data
$ RndFileName = $ imgPath. $ milliSecond. $ key. '. '. substr ($ value,-3, 3); // Generate the file path ???? $ Key ????
$ Fileurl = $ imgUrl. $ milliSecond. $ key. '.'. substr ($ value,-3, 3); // Generate the file path under the root path
If ($ get_file) {// if the file has been obtained
$ Fp = @ fopen ($ rndFileName, 'w'); // create a path and file
@ Fwrite ($ fp, $ get_file); // write image data
@ Fclose ($ fp); // Close the write data stream
$ Body = ereg_replace ($ value, $ fileurl, $ body); // check whether the $ body contains a string that matches the value. If yes, replace it with fileurl.
}
Echo $ body;
}
Who can explain the functions of this method?
What does $ body mean? Php variable ereg_replace shared:
------ Solution --------------------
$ Body only causes program errors!
------ Solution --------------------
If it weren't for you to paste the full code
Otherwise, it is not a normal practice to directly echo $ body in the function as the debugging code left by the author.