Tom*_*lic 3 php codeigniter preg-match
我使用 CI_Minifier 并且在更新我的 PHP 后遇到了问题。
现在我在使用该preg_match功能时收到错误消息。
if (!preg_match("/^[\w-:]+$/", $tag)) { #error line
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
if ($this->char === '<') {
$this->link_nodes($node, false);
return true;
}
if ($this->char==='>') {
$node->_[HDOM_INFO_TEXT] .= '>';
}
$this->link_nodes($node, false);
$this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next
return true;
}
Run Code Online (Sandbox Code Playgroud)
错误是:
编译失败:字符类中偏移量 4 处的范围无效
Tot*_*oto 11
Escape the hyphen:
if (!preg_match("/^[\w\-:]+$/", $tag)) {
Run Code Online (Sandbox Code Playgroud)
or put it at the beginning of character class:
if (!preg_match("/^[-\w:]+$/", $tag)) {
Run Code Online (Sandbox Code Playgroud)
或最后:
if (!preg_match("/^[\w:-]+$/", $tag)) {
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5994 次 |
| 最近记录: |