Products
GG网络技术分享 2025-03-18 16:15 1
This question already has an answer here:
4 answers
3 answers
1 answer
I am using simple_html_dom.inc.php for url extractor. The codes are working normaly without problem. But i am getting the following Warning from PHP7.3
Warning: preg_match(): Compilation failed: invalid range in character
class at offset 4 in 1387
You can see the error line in this link: Error Line 1387
if (!preg_match(\"/^[\\w-:]+$/\", $tag)) {$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;
}
Do you have a solution for this problem? Thanks in advance.
</div>
PHP 7.3 upgraded from PCRE to PCRE2. Which is much more strict on regular expressions. For example, you need to escape -
between square brackets. And this is the problem in you regex.
Changing it to /^[\\w\\-:]+$/
should solve your problem.
PHP 目前依旧是其它脚本语言强劲的竞争对手,这主要归功于其核心维护团队的快速更新。
自从 PHP 7.0 发布以来,社区见证了许多新特性的诞生,极大地改进了开发者在项目中应用 PHP 的方式。提高 PHP 应用的性能和安全性,是这些改进的主要目的。
PHP 最近实现了又一个里程碑 —— 发布 PHP 7.3。新版本带来了一些急需的更新。
在本文中,我将论述新推出的 PHP 7.3 特性 和更新。好消息是,你可以在你的测试服务器上自行安装新版本、查看新功能。但老生常谈,切勿在生产服务器上使用 RC 版本更新,可能会破坏你已经上线的应用。
以下是7.3版中引入的一些更新,与以前的版本相比,它们大大提高了 PHP 7.3 的性能 。
让我们逐一讨论上述的每一个更新。
Heredoc 和 Nowdoc 语法能够在使用多行长字符串时起到很大帮助。它要求结束标识符应当为出现在新行的首个字符串。
Demand feedback