时间:2021-07-01 10:21:17 帮助过:4人阅读
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();
}
http://www.bkjia.com/PHPjc/445448.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445448.htmlTechArticlephp鍒ゆ柇绫绘槸鍚﹀瓨鍦ㄥ嚱鏁?class_exists//bool class_exists ( string $class_name [, bool $autoload = true ] )//姝ゅ姛鑳芥槸鍚︾粰瀹氱殑绫昏瀹氫箟妫€鏌ャ€俆his function checks w...