简体   繁体   English

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

[英]How to rename or overwrite php function?

How i can redefine a function in php with runkit? 如何使用Runkit在php中重新定义函数?

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

i seted in php.ini 我在php.ini中设置

runkit.internal_override=1

when i run, it show: 当我跑步时,它显示:

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

how i can fix it? 我该如何解决? please help me! 请帮我!

I would guess this doesn't work because require_once is a language construct, not a function. 我猜这是行不通的,因为require_once是一种语言构造,而不是一个函数。
I don't know if there's any other possibility of overriding it, I'd think not. 我不知道是否还有其他方法可以覆盖它,我想不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM