Home php教程 php手册 _autoload加载解决方案

_autoload加载解决方案

Jun 06, 2016 pm 07:42 PM
autoload load back solution

__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
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

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution for Win11 unable to install Chinese language pack Solution for Win11 unable to install Chinese language pack Mar 09, 2024 am 09:15 AM

Solution for Win11 unable to install Chinese language pack

Reasons and solutions for scipy library installation failure Reasons and solutions for scipy library installation failure Feb 22, 2024 pm 06:27 PM

Reasons and solutions for scipy library installation failure

Error loading plugin in Illustrator [Fixed] Error loading plugin in Illustrator [Fixed] Feb 19, 2024 pm 12:00 PM

Error loading plugin in Illustrator [Fixed]

An effective solution to solve the problem of garbled characters caused by Oracle character set modification An effective solution to solve the problem of garbled characters caused by Oracle character set modification Mar 03, 2024 am 09:57 AM

An effective solution to solve the problem of garbled characters caused by Oracle character set modification

Oracle NVL function common problems and solutions Oracle NVL function common problems and solutions Mar 10, 2024 am 08:42 AM

Oracle NVL function common problems and solutions

Resolve Unable to start application properly error code 0xc000007b Resolve Unable to start application properly error code 0xc000007b Feb 20, 2024 pm 01:24 PM

Resolve Unable to start application properly error code 0xc000007b

Stremio subtitles not working; error loading subtitles Stremio subtitles not working; error loading subtitles Feb 24, 2024 am 09:50 AM

Stremio subtitles not working; error loading subtitles

Common causes and solutions for Chinese garbled characters in MySQL installation Common causes and solutions for Chinese garbled characters in MySQL installation Mar 02, 2024 am 09:00 AM

Common causes and solutions for Chinese garbled characters in MySQL installation

See all articles