PHP8 runkit7_method_remove — 動態(tài)刪除給定的方法

2023-10-07 10:52 更新

(PECL runkit7 >= Unknown)

runkit7_method_remove — 動態(tài)刪除給定的方法

說明

runkit7_method_remove(string $class_name, string $method_name): bool
注意: 此函數(shù)不能用來操作當前正常運行(或運行鏈上)的方法。

參數(shù)

class_name

要刪除方法的類。

method_name

要刪除的方法的名稱。

返回值

成功時返回 true, 或者在失敗時返回 false。/

示例

示例 #1 runkit7_method_remove() example

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

function bar() {
return "bar!\n";
}
}

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

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

?>

以上示例會輸出:

bar

參見

  • runkit7_method_add() - 動態(tài)地向給定類添加新方法。
  • runkit7_method_copy() - 從一個類復(fù)制方法到另一個類。
  • runkit7_method_redefine() - 動態(tài)地更改給定方法的代碼。
  • runkit7_method_rename() - 動態(tài)地更改給定方法的名稱。
  • runkit7_function_remove() - 移除函數(shù)定義。


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號