PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

classkit_method_rename> <classkit_method_redefine
Last updated: Mon, 26 Nov 2007

view this page in

classkit_method_remove

(PECL classkit:0.1-0.4 runkit:0.7-0.9)

classkit_method_remove — Dynamically removes the given method

说明

bool classkit_method_remove ( string $classname , string $methodname )

Note: 本函数不能用于操作当前正在运行(或运行链上)的方法。

Warning

本函数是实验性的。本函数的行为,包括函数名称以及其它任何关于本函数的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本函数风险自担。

参数

classname

The class in which to remove the method

methodname

The name of the method to remove

返回值

如果成功则返回 TRUE,失败则返回 FALSE

范例

Example#1 classkit_method_remove() example

<?php
class Example {
    function 
foo() {
        return 
"foo!\n";
    }
    
    function 
bar() {
        return 
"bar!\n";
    }
}

// Remove the 'foo' method
classkit_method_remove(
    
'Example',
    
'foo'
);

echo 
implode(' 'get_class_methods('Example'));

?>

上例将输出:

bar



add a note add a note User Contributed Notes
classkit_method_remove
There are no user contributed notes for this page.

classkit_method_rename> <classkit_method_redefine
Last updated: Mon, 26 Nov 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites