用法
method_exists ( $object, $method_name );
定義和用法
它檢查給定對象中是否存在類方法。
參數
Sr.No | 參數及說明 |
---|---|
1 |
object(Required) 被測對象 |
2 |
mthod_name(Required) 方法名稱。 |
返回值
如果已為給定對象定義了 method_name 給出的方法,則返回 TRUE,否則返回 FALSE。
示例
下麵是這個函數的用法~
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'anything'));
?>
它將產生以下結果 -
bool(false)
相關用法
- PHP method_exists()用法及代碼示例
- PHP metaphone()用法及代碼示例
- PHP mhash_get_hash_name()用法及代碼示例
- PHP mysqli_get_server_info()用法及代碼示例
- PHP money_format()用法及代碼示例
- PHP mysqli_data_seek()用法及代碼示例
- PHP mysqli_insert_id()用法及代碼示例
- PHP mysqli_fetch_assoc()用法及代碼示例
- PHP mkdir()用法及代碼示例
- PHP mysqli_connect_error()用法及代碼示例
- PHP mhash_keygen_s2k()用法及代碼示例
- PHP microtime()用法及代碼示例
- PHP mysqli_fetch_all()用法及代碼示例
- PHP mt_rand( )用法及代碼示例
- PHP mysqli_next_result()用法及代碼示例
- PHP mysqli_stmt_affected_rows()用法及代碼示例
- PHP mime_content_type()用法及代碼示例
- PHP mysqli_begin_transaction()用法及代碼示例
- PHP mysqli_real_escape_string()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP - Function method_exists()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。