php - 如何重命名或覆盖php函数?

标签 php runkit

我如何使用 runkit 在 php 中重新定义一个函数?

$helloWorld = 'echo "Call require_once";';
runkit_function_redefine('require_once', '$word', $helloWorld);
require_once("abc.php");

我在 php.ini 中设置

runkit.internal_override=1

当我运行时,它显示:

Warning: runkit_function_redefine() [function.runkit-function-redefine]: require_once() not found in hhd_debug.php on line 2

Warning: require_once(abc.php) [function.require-once]: failed to open stream: No such file or directory in hhd_debug.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'abc.php' (include_path='.;xampp\php\PEAR') in hhd_debug.php on line 3

我该如何解决?请帮助我!

最佳答案

我猜这是行不通的,因为 require_once 是一个语言结构,而不是一个函数。
我不知道是否还有其他可能覆盖它,我认为不会。

关于php - 如何重命名或覆盖php函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11077897/

相关文章:

javascript - html 包含许多类似的选择,这些选择在更改时会使用react

php - PHP 中是否有 is_infinite() 的日常实际应用?

javascript - 更改ajax中按钮的文本

php - joomla 2.5 模块中的图像插入字段

php - 在不通过网络浏览器进行清理的情况下查看访问日志是否危险?

javascript - 如何使用异步 Node 库传递请求 header ?

php - 我在哪里可以获得 PHP 5.3+ 的 runkit DLL 扩展?

PHPUnit 设置以使用 dataProvider 运行单个测试