/**
* Get the image path in the replacement article
* @param string $xstr content
* @param string $keyword The file name of the created photo
* @param string $oriweb URL
* @ return string
*
*/
function replaceimg($xstr,$keyword, $ oriweb){
//Save path
$d = date('Ymd', time());
$dirslsitss = '/var/www/weblist/uploads/'.$keyword .'/'.$d;//Whether the category exists
if(!is_dir($dirslsitss)) {
@mkdir($dirslsitss, 0777);
}
// Matching image's src
preg_match_all('#
]*>#i', $xstr, $match);
foreach($match[1] as $imgurl){
$imgurl = $imgurl;
if(is_int(strpos($imgurl, 'http'))){
curl);
If(!empty($img)) {
//Save the image to the server
$fileimgname = time()."-".rand(1000,9999).".jpg";
."/".$fileimgname; > }
http://www.bkjia.com/PHPjc/328059.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/328059.html
TechArticle Copy code The code is as follows: /** * Get the image path in the replacement article* @param string $xstr content* @param string $keyword The file name of the created photo* @param string $oriweb URL...