Please help me to see what error classes are automatically loaded. other classes can be automatically loaded. that is, the tpl class cannot automatically load Fatalerror: ClassTplnotfoundinD: AppServwwwyshopconfigsrun. inc. phponline22 I manually requireROOT_PATH.publicTpl.class.php; I also asked you to help me see what the error is.
Other classes can be automatically loaded, that is, the tpl class cannot be automatically loaded.
Fatal error: Class 'tpl 'not found in D: \ AppServ \ www \ yshop \ configs \ run. inc. php on line 22
This error is returned when I manually require ROOT_PATH. '/public/Tpl. class. php';
Fatal error: Access level to Tpl ::__ construct () must be public (as in class Smarty) in D: \ AppServ \ www \ yshop \ public \ Tpl. class. php on line 46
Class Tpl extends Smarty {
Static private $ instance;
Static public function getInstance (){
If (! (Self: $ instance instanceof self )){
Self: $ instance = new self ();
}
Return self: $ instance;
}
Private function _ clone (){
}
Private function _ construct (){
$ This-> setConfigs ();
}
Private function setConfigs (){
// Template directory
$ This-> template_dir = ROOT_PATH. '/view /';
// Compile the Directory
$ This-> compile_dir = ROOT_PATH. '/compile /';
// Configure the variable Directory
$ This-> config_dir = ROOT_PATH. '/configs /';
// Cache Directory
$ This-> cache_dir = ROOT_PATH. '/cache /';
// Whether to enable the cache. in the website development and debugging stage, we should disable the cache.
$ This-> caching = 0;
// Cache declaration period
$ This-> cache_lifetime = 60*60*24;
// Left delimiter
$ This-> left_delimiter = '{';
// The right separator
$ This-> right_delimiter = '}';
}
} There are 46 rows.
?>
------ Solution --------------------
That is because the access permission of your Smarty class constructor (_ construct) is public. according to the oo rule, the access permission of the same method that the subclass rewrites must be lower than that of the parent class, the so-called high-low relationship is (private> protected> public)