Apache 里的错误报告如下:
PHP Fatal error: Uncaught Error: Call to undefined function eregi() in …
导致Magento 的 Payway 插件无法正常使用!
PHP5.3 的话则会提示:Function eregi() is deprecated…
搜了一下这个函数,发现官方介绍里这么说明:
(PHP 4, PHP 5)
eregi — Case insensitive regular expression match
This function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.
Alternatives to this function include:
- preg_match() (with the i (
PCRE_CASELESS
) modifier)
就是说在 PHP5.3、PHP7 里是不能正常使用该函数的。
解决办法是用 preg_match() i 参数替代,可以把相关代码做如下修改:
eregi ( “^[_0-9a-z-]{1,30}$”, $key );
改为:
preg_match ( “/^[_0-9a-z-]{1,30}$/i”, $key );