runkit_method_rename
(PECL runkit >= 0.7.0)
runkit_method_rename - 动态更改给定方法的名称
描述
bool runkit_method_rename ( string $classname , string $methodname , string $newname )
注意:此函数不能用于操作当前正在运行的(或链接的)方法。
参数
classname
要重命名该方法的类
methodname
要重命名的方法的名称
newname
重命名方法的新名称
返回值
成功返回TRUE
或失败时返回FALSE。
例子
Example #1 runkit_method_rename() example
<?php
class Example {
function foo() {
return "foo!\n";
}
}
// Rename the 'foo' method to 'bar'
runkit_method_rename(
'Example',
'foo',
'bar'
);
// output renamed function
echo Example::bar();
?>
上面的例子将输出:
foo!
← runkit_method_remove
runkit_return_value_used →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com