作者 lyh

gx

... ... @@ -437,8 +437,6 @@ function isEnglish($str) {
*/
function characterTruncation($string,$pattern){
preg_match($pattern, $string, $matches);
var_dump($matches);
die();
if (isset($matches[1])) {
$result = $matches[1];
return $result; // 输出:这是footer标签的内容
... ...
... ... @@ -106,7 +106,7 @@ class BTemplateLogic extends BaseLogic
]
);
//字符串截取
$this->param['head_html'] = characterTruncation($this->param['html'],'/<header[^>]*>(.*?)<\/header>/');
$this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
var_dump($this->param['head_html']);
die();
// $this->param['main_html'] = characterTruncation($this->param['html'],'/<main[^>]*>(.*?)<\/main>/');
... ...