preg_match_all 性能低.效率差.有其它办法吗???

WBOY
Release: 2016-06-23 14:23:49
Original
1039 people have browsed it

原来用preg_replace_callback发现效率低.
改成preg_match_all  + str_replace
str_replace几乎不花时间. preg_match_all执行一次要花0.5秒以上.


回复讨论(解决方案)

那肯定是正则匹配花的时间长,贴出代码瞧瞧。

preg_match_all("/(\"|\'|=)\/column.php\?cid=(\d+)&s(\d+)=(\d+)&page=(\d+)/i", $result, $m);


不会是用  | 或的原因吧?

我吊啊.真是这鸟原因啊

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template