最近,在项目中发现,php 的 __autoload 方法失效了。调试了好久,百思不得其解,查了下资料才知道原来是 Smarty 的原因。新版的 Smarty 改变了autoload的方式。
解决方法是:在 Smarty 的包含类文件后加一段代码,spl_autoload_register("__autoload");
如下:
<?php
define(‘ROOT_PATH’, dirname(__FILE__));
http://www.gaodaima.com/50265.htmlphp autoload:解决 PHP 中的 __autoloa_php
require_once ROOT_PATH . ‘/includes/smarty/Smarty.class.php’;
spl_autoload_register("__autoload"); // 添加这段代码
?>
本文链接http://www.cxybl.com/html/wlbc/Php/20121013/32997.html
欢迎大家阅读《php autoload:解决 PHP 中的 __autoloa_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码