public function _filtercontent($content){
$content = preg_replace('/<\/?(html|head|meta|link|base|body|title|style|script|form|iframe|frame|frameset|p)[^><]*>/i','',$content);
$pattern ='<img.*?src="(.*?)">';
preg_match_all($pattern,$content,$matches);
return $matches[1];
}此方法返回的是content中的所有图片的url组成的数组。public function _setcontenttoarray($content){
$content = preg_replace('/<\/?(img)[^><]*>/i','#',$content);
$res = preg_replace('/<\/?(html|head|meta|link|base|body|title|style|script|form|iframe|frame|frameset|p|span|strong|sup)[^><]*>/i','',$content);
$res = str_replace(' ', "\r\t ", $res);
$res = str_replace('<br/><br/>', "\r\n", $res);
$res = str_replace('<br/>', "\r\n", $res);
$res = str_replace('<br>', "\r\n", $res);
$arr = explode('#', $res);
foreach( $arr as $k=>$v){
if( !$v )
unset( $arr[$k] );
}
return $arr;
}此方法返回的是content中的文字切割成的数组ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。