欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2023-12-31 16:13:52
...
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...

上一篇:

下一篇: