首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

runkit_method_rename

(PECL runkit >= 0.7.0)

runkit_method_rename - 动态更改给定方法的名称

描述

代码语言:javascript
复制
bool runkit_method_rename ( string $classname , string $methodname , string $newname )

注意:此函数不能用于操作当前正在运行的(或链接的)方法。

参数

classname

要重命名该方法的类

methodname

要重命名的方法的名称

newname

重命名方法的新名称

返回值

成功返回TRUE或失败时返回FALSE。

例子

Example #1 runkit_method_rename() example

代码语言:javascript
复制
<?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();
?>

上面的例子将输出:

代码语言:javascript
复制
foo!

← runkit_method_remove

runkit_return_value_used →

扫码关注腾讯云开发者

领取腾讯云代金券