W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
(PECL runkit7 >= Unknown)
runkit7_method_rename — 動(dòng)態(tài)更改給定方法的名稱
runkit7_method_rename(string $class_name, string $source_method_name, string $target_method_name): bool
注意: 此函數(shù)不能用來操作當(dāng)前正常運(yùn)行(或運(yùn)行鏈上)的方法。
class_name
要重命名方法的類。
source_method_name
要重命名的方法的名稱。
target_method_name
要給重命名的方法賦予的新名稱。
成功時(shí)返回 true, 或者在失敗時(shí)返回 false。
示例 #1 runkit7_method_rename() example
<?php
class Example {
function foo() {
return "foo!\n";
}
}
// Rename the 'foo' method to 'bar'
runkit7_method_rename(
'Example',
'foo',
'bar'
);
// output renamed function
echo (new Example)->bar();
?>
以上示例會(huì)輸出:
foo!
runkit7_method_add() - 動(dòng)態(tài)添加新方法到指定類
runkit7_function_rename() - 更改函數(shù)的名稱
runkit7_method_remove() - 動(dòng)態(tài)移除給定方法
unkit7_method_redefine() - 動(dòng)態(tài)更改給定方法的代碼
runkit7_method_copy() - 從一個(gè)類復(fù)制方法到另一個(gè)類
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: