Who can help me explain how to automatically load the class/* require (ROOT. 'include/db. class. php '); require (ROOT. 'include/conf. class. php '); require (ROOT. 'include/log. class. php '); require (R, who can help me explain how to automatically load classes?
Function _ autoload ($ class ){
If (strtolower (substr ($ class,-5) = 'model '){
Require (ROOT. 'model/'. $ class.'. class. php ');
} Else {
Require (ROOT. 'include/'. $ class.'. class. php ');
}
}
The above deregistered is the manual loading class, and the following is the automatic loading
I don't quite understand where the $ class comes from
------ Solution --------------------
When you use new classname
If the classname class does not exist, php will call the _ autoload function and pass the classname
------ Solution --------------------
$ Class is the class name that cannot be found
The automatically loaded class is the class that cannot be automatically loaded.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.