我如何使用 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/