0
我需要重写PHP的标准功能之一。在JavaScript中,我会这样做:
<script type="text/javascript">
window.alert = function(str) {
document.write(str);
}
alert("hello");
</script>
是否有可能在php中做到这一点?
我需要重写PHP的标准功能之一。在JavaScript中,我会这样做:
<script type="text/javascript">
window.alert = function(str) {
document.write(str);
}
alert("hello");
</script>
是否有可能在php中做到这一点?
可能重复[重新定义内置PHP函数(http://stackoverflow.com/q/2326835/),(HTTP [如何重新定义PHP函数?]://计算器。 (重新定义PHP函数?)(http://stackoverflow.com/q/2640958/),[是否有可能在PHP中覆盖函数](http://stackoverflow.com/q/q/6925736/)/3620659 /) – outis 2012-02-10 17:06:26
你试图“覆盖”什么特定的PHP函数?你想达到什么目的? – 2012-02-10 17:07:04
... [是否有可能取代(monkeypatch)PHP函数?](http://stackoverflow.com/q/530649/),[是否有可能取代PHP中的函数(如邮件),并使其做别的事情?](http://stackoverflow.com/q/1837184/),[Php重新定义类方法或类](http://stackoverflow.com/q/137006/) – outis 2012-02-10 17:21:12