PHP

WBOY
Release: 2016-07-20 11:01:25
Original
1078 people have browsed it

PHP This 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...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template