php鍒ゆ柇绫绘槸鍚﹀瓨鍦ㄥ嚱鏁?class_exists_PHP鏁欑▼ | 甯涔嬪

WBOY
发布: 2016-07-20 11:01:25
原创
1068 人浏览过

php鍒ゆ柇绫绘槸鍚﹀瓨鍦ㄥ嚱鏁?class_exists//bool class_exists ( string $class_name [, bool $autoload = true ] )//姝ゅ姛鑳芥槸鍚︾粰瀹氱殑绫昏瀹氫箟妫€鏌ャ€俆his function checks whether or not the given class has been defined.  

php鏁欑▼鍒ゆ柇绫绘槸鍚﹀瓨鍦ㄥ嚱鏁?class_exists
//bool class_exists ( string $class_name [, bool $autoload = true ] )
//姝ゅ姛鑳芥槸鍚︾粰瀹氱殑绫昏瀹氫箟妫€鏌ャ€倀his function checks whether or not the given class has been defined.

//杩斿洖true锛屽鏋渃lass_name鏄竴涓畾涔夌殑绫伙紝鍚﹀垯杩斿洖false銆?br /> //瀹炰緥

if (class_exists('myclass')) {
    $myclass = new myclass();
}

 

function __autoload($class)
{
    include($class . '.php');

    // check to see whether the include declared the class
    if (!class_exists($class, false)) {
        trigger_error("unable to load class: $class", e_user_warning);
    }
}

if (class_exists('myclass')) {
    $myclass = new myclass();
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445448.htmlTechArticlephp鍒ゆ柇绫绘槸鍚﹀瓨鍦ㄥ嚱鏁?class_exists//bool class_exists ( string $class_name [, bool $autoload = true ] )//姝ゅ姛鑳芥槸鍚︾粰瀹氱殑绫昏瀹氫箟妫€鏌ャ€俆his function checks w...
相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板