Home > php教程 > php手册 > body text

_autoload加载解决方案

WBOY
Release: 2016-06-06 19:42:55
Original
957 people have browsed it

__autoload加载 后台添加商品分类的时候出现Fatalerror:Cannotredeclare__autoload()(previouslydeclaredinF:\wamp\www\ship\include\init.php:31)inF:\wamp\www\ship\include\init.phponline39 init.php define('ROOT',str_replace('\\','/',dirname(dirname

__autoload加载
后台添加商品分类的时候出现 Fatal error: Cannot redeclare __autoload() (previously declared in F:\wamp\www\ship\include\init.php:31) in F:\wamp\www\ship\include\init.php on line 39
init.php
define('ROOT',str_replace('\\','/',dirname(dirname(__FILE__))) . '/');
define('DEBUG',true);


require(ROOT . 'include/lib_base.php');

function __autoload($class) {
    if(strtolower(substr($class,-5)) == 'model') {
        require(ROOT . 'Model/' . $class . '.class.php');
    } else if(strtolower(substr($class,-4)) == 'tool') {
        require(ROOT . 'tool/' . $class . '.class.php');
    } else {
        require(ROOT . 'include/' . $class . '.class.php');
    }
}


$_GET = _addslashes($_GET);
$_POST = _addslashes($_POST);
$_COOKIE = _addslashes($_COOKIE);




sessio【本文来自鸿网互联 (http://www.68idc.cn)】n_start();

if(defined('DEBUG')) {
    error_reporting(E_ALL);
} else {
    error_reporting(0);
}


------解决思路----------------------
看错误信息呢, 函数重定义了, 看看是不是在其他地方还定义了这个函数。。
------解决思路----------------------
重复定义__autoload,在这个文件里面看看F:\wamp\www\ship\include\init.php
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!