$value)"/>
PHP头条
热点:

PHP实现发表文章时自动保存图片


]+?[jpg|jpeg|png|gif|bmp|ico|pcx|tif|raw|tga]?[\'|\"]?)/iU",$content1,$img_array);
$img_array = array_unique(dhtmlspecialchars($img_array[2]));
set_time_limit(0);
foreach ($img_array as $key => $value) {
$get_file = file_get_contents($value);
$filetime = time();
$filepath = "../uploadfile/".date("Y",$filetime)."/".date("m",$filetime)."/";
!is_dir($filepath) ? mkdirs($filepath) : null;
$filename = date("YmdHis",$filetime).random(1).'.'.substr($value,-3,3);
$fp = @fopen($filepath.$filename,"w");
@fwrite($fp,$get_file);
fclose($fp);
$content1 = preg_replace("/".addcslashes($value,"/")."/isU", "/uploadfile/".date("Y",$filetime)."/".date("m",$filetime)."/".$filename, $content1);
?>


本文地址:

转载随意,但请附上文章地址:-)

www.phpzy.comtrue/php/40105.htmlTechArticlePHP实现发表文章时自动保存图片 ]+?[jpg|jpeg|png|gif|bmp|ico|pcx|tif|raw|tga]?[\|\"]?)/iU",$content1,$img_array);$img_array = array_unique(dhtmlspecialchars($img_array[2]));set_time_limit(0);foreach ($img_array as $key => $value)...

相关文章

PHP之友评论

今天推荐