Today, Smarty to 3.0 was updated and found that the __autoload () in the project was not available,
As a novice beginner to learn PHP, engaged in a half-day to understand the problem in their conflict, depressed for several days. After viewing, Smarty3.0 in the Smarty2_bc_notes file, learned that Smarty3.0 and PHP __autoload () Conflict:
——————————————————————————-——-
= = Autoloader = =
Smarty 3 does register its own autoloader with Spl_autoload_register. If Your code has
An existing __autoload function then this function must is explicitly on
The __autoload stack. http://us3.php.net/manual/en/function.spl-autoload-register.php
For further details.
——————————— —————————————————————
The workaround is to register your own add-in class with Spl_autoload_register ().
Now give the code before and after the configuration:
————————————————————————————————————
if (substr ($className,-6) = = "Action") {include (App_class_path. ' action/'. $className. ")
Class.php "); }elseif (substr ($className,-5) = = "Model") {include (App_class_path. ' model/'. $className. ").
Class.php "); }elseif ($className = = "Smarty") {require_once net_root. "
Smarty/smarty.class.php "; }elseif (substr ($className,-6) = = "Public") {include (App_class_path. ' public/'. $className. ")
Class.php "); —————————————————————————————— class Classautoloader {public Function __construct () {Spl_autoload_reg
Ister (Array ($this, ' loader '));
The Private Function loader ($className) {if (substr ($className,-6) = = "Action") {echo ' 1 '; Include App_class_path. ' action/'. $className. ".
Class.php ");
}elseif (substr ($className,-5) = = "Model") {echo ' 2 '; Include App_class_path. ' model/'. $className. ".
Class.php ");
}elseif ($className = = "Smarty") {echo ' 3 '; Require_once net_root. "
Smarty/smarty.class.php "; }elseif (SubsTR ($className,-6) = = "Public") {echo ' 4 '; Include App_class_path. ' public/'. $className. ".
Class.php "); }} $autoloader = new Classautoloader ();
Hope to help meet the problem of friends, so that everyone less detours.