正在显示
2 个修改的文件
包含
1 行增加
和
3 行删除
| @@ -437,8 +437,6 @@ function isEnglish($str) { | @@ -437,8 +437,6 @@ function isEnglish($str) { | ||
| 437 | */ | 437 | */ |
| 438 | function characterTruncation($string,$pattern){ | 438 | function characterTruncation($string,$pattern){ |
| 439 | preg_match($pattern, $string, $matches); | 439 | preg_match($pattern, $string, $matches); |
| 440 | - var_dump($matches); | ||
| 441 | - die(); | ||
| 442 | if (isset($matches[1])) { | 440 | if (isset($matches[1])) { |
| 443 | $result = $matches[1]; | 441 | $result = $matches[1]; |
| 444 | return $result; // 输出:这是footer标签的内容 | 442 | return $result; // 输出:这是footer标签的内容 |
| @@ -106,7 +106,7 @@ class BTemplateLogic extends BaseLogic | @@ -106,7 +106,7 @@ class BTemplateLogic extends BaseLogic | ||
| 106 | ] | 106 | ] |
| 107 | ); | 107 | ); |
| 108 | //字符串截取 | 108 | //字符串截取 |
| 109 | - $this->param['head_html'] = characterTruncation($this->param['html'],'/<header[^>]*>(.*?)<\/header>/'); | 109 | + $this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s'); |
| 110 | var_dump($this->param['head_html']); | 110 | var_dump($this->param['head_html']); |
| 111 | die(); | 111 | die(); |
| 112 | // $this->param['main_html'] = characterTruncation($this->param['html'],'/<main[^>]*>(.*?)<\/main>/'); | 112 | // $this->param['main_html'] = characterTruncation($this->param['html'],'/<main[^>]*>(.*?)<\/main>/'); |
-
请 注册 或 登录 后发表评论