在openwrt的php4中没有定义preg_match?

时间:2013-10-25 15:52:01

标签: php openwrt

我已经通过命令行(opkg install)在openwrt中安装了PHP4和PHP4-CGI包

当我把这个简单的代码放在openwrt www文件夹中时,

<?php
$subject = "abcdef";
$pattern = '/^def/';
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3);
print_r($matches);
?>

我收到了这个错误

  

致命错误:调用未定义的函数:第4行的/www/phptest.php中的preg_match()

但php手册说preg_match()也是在php4中定义的..这个错误可能是什么原因造成的?是否还有其他PHP模块需要安装?
或者是否有其他方法可以用于preg_match?

1 个答案:

答案 0 :(得分:0)

将函数preg_match()(PCRE)更改为ereg,它适用于openwrt中的php4。