0



当我尝试将这个简单的代码放在 openwrt www 文件夹中时,我已经通过命令行(opkg install)在 openwrt 中安装了 PHP4 和 PHP4-CGI 包 ,

<?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 的替代方法?

4

1 回答 1

0

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

于 2013-10-28T09:36:29.123 回答