郁闷的问题,rename在foreach中不执行,
当rename($kb,$newfile.$dimg);在foreach外面的时候是执行的,
但是到了foreach里面就不行了,哪位大神讲解下?到底是咋了。怎么解决!$hkt=$db->get_one("select fid,attachmentdomain,attachmentdir from news_sort where fid='$fid'");
$postdb[content]=str_replace("http://www_mydomain.com","../../".$attachmentdir,$postdb[content]);
$newfile="../../upload_files/".$hkt[attachmentdir]."/";
preg_match_all("/<[img|IMG].*?src=[\\\'|\\\"][^http](.*?(?:[\.gif|\.jpg]))[\\\'|\\\"].*?[\/]?>/i",$postdb[content],$imglist);
foreach($imglist[1] as $kb){
$kb=str_replace("\"","",$kb);
$dimg=explode("/",$kb);
$dimg=$dimg[count($dimg)-1];
$kbimg=$hkt[attachmentdomain]."/".$dimg;
$postdb[content]=str_replace($kb,$kbimg,$postdb[content]);
rename($kb,$newfile.$dimg);
unlink($kb);
}