重新定义内置的PHP函数 [英] Redefine Built in PHP Functions

查看:84
本文介绍了重新定义内置的PHP函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重新定义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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆