PHP - 覆盖现有的功能 [英] PHP - override existing function

查看:73
本文介绍了PHP - 覆盖现有的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以重新声明一个具有相同名称但代码不同的现有函数吗?或者以某种方式禁用旧功能?

Can I redeclare a existing function, with the same name, but different code? Or somehow "disable" the old function?

我想重新定义一个核心WordPress功能,但由于插件和主题调用这个功能很多,我需要保持相同函数名称。

I want to redefince a core WordPress function, but since plugins and theme call this function a lot, I need to keep the same function name.

推荐答案

仅当您使用类似APD的扩展zend引擎才能实现这一点时:

Only if you use something like APD that extends the zend engine to allow for that:

简介

Intro

覆盖方法Docs

注意:Runkit似乎是比APD更好的选择,因为它更专用于此目的,并允许您保留原始方法在不同地址完好无损。

Note: Runkit seems like a better option than APD since it's more specific to this purpose and would allow you to keep the original method intact at a different address.

这篇关于PHP - 覆盖现有的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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