PHP _autoload函数知识点

WBOY
Release: 2016-06-13 12:27:42
Original
875 people have browsed it

PHP __autoload函数知识点

__autoload函数主要是用来包含不存在的类文件,当初始化的类不存在的时候

function __autoload($param){
$file = $param.'.php';
if(file_exists($file)){
require_once $file;
}
}
//实例化footer类的时候会,没有找到footer类,自动调用__autoload加载文件
$obj = new footer();

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