您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

一个比较全面的截取函数(多用于采集内容的分析)

2024/2/27 14:44:35发布12次查看
1){ $title_1=explode($title_var[0],$str); $title_2=explode($title_var[1],$title_1[1]); return strip_s(strip_tags($title_2[0])); }else{ preg_match_all($pat,$str,$res); return strip_s(strip_tags($res[1][0])); } } function getcon2($pat,$str){ $title_var=explode ({data},$pat); if(count($title_var)>1){ $title_1=explode($title_var[0],$str); $title_2=explode($title_var[1],$title_1[1]); return $title_2[0]; }else{ preg_match_all($pat,$str,$res); return $res[1][0]; } } function strip_s($str){ $str = preg_replace (/(\s+)/, ' ', $str); $str = str_replace(chr(13),'',$str); $str = str_replace(chr(10),'
',$str); $str = ltrim($str); $str = trim($str); return $str; } ?>
复制代码
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product