定义和用法
如果 method_name的方法在 object 所指的对象类中定义则返回 TRUE 否则返回 FALSE.
语法
bool method_exists(object object,string method_name)
参数解释:
object :对象
method_name :方法名数据
返回值
将返回一个bool值。
例子
class index{
function init(){
echo "start";
}
}
$ss = new index();
if (method_exists($ss, init)) {
$ss->init();
}else{
echo "Action does not exist";
}0daybank
文章评论