PHP头条
热点:

解决 PHP 中的 __autoload 和 Smarty 冲突


最近,在项目中发现,PHP 的 __autoload 方法失效了。调试了好久,百思不得其解,查了下资料才知道原来是 Smarty 的原因。新版的 Smarty 改变了autoload的方式。


        解决方法是:在 Smarty 的包含类文件后加一段代码,spl_autoload_register("__autoload");

        如下:

<?php  
    define('ROOT_PATH', dirname(__FILE__)); 
    require_once ROOT_PATH . '/includes/smarty/Smarty.class.php'; 
    spl_autoload_register("__autoload");  // 添加这段代码  
?> 

 

摘自 Lee.的专栏

www.phpzy.comtrue/phprm/19103.htmlTechArticle解决 PHP 中的 __autoload 和 Smarty 冲突 最近,在项目中发现,PHP 的 __autoload 方法失效了。调试了好久,百思不得其解,查了下资料才知道原来是 Smarty 的原因。新版的 Smarty 改变了autoload的...

相关文章

    暂无相关文章

PHP之友评论

今天推荐