重新定义内置的PHP函数 [英] Redefine Built in PHP Functions
问题描述
我想重新定义PHP中已经构建的某些函数,例如echo()或time()-我不需要在一个测试脚本中就全局定义这些函数.
I would like to redefine certain functions in PHP that are already built for example, echo() or time() - I don't need to define these functions globally, just within a single script for testing.
我认为这可以在Perl中完成,但可以在PHP中完成-可以吗?
I think this can be done in Perl but in PHP - Is this possible?
推荐答案
runkit_function_redefine —用新的实现替换函数定义
runkit_function_redefine — Replace a function definition with a new implementation
注意:默认情况下,只能删除,重命名或删除用户空间功能 修改的.为了覆写 内部功能,必须启用 runkit.internal_override设置 在php.ini中.
Note: By default, only userspace functions may be removed, renamed, or modified. In order to override internal functions, you must enable the runkit.internal_override setting in php.ini.
这篇关于重新定义内置的PHP函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!