Home > Backend Development > PHP Tutorial > Baidu Editor introduces website initialization files, resulting in failure to upload images

Baidu Editor introduces website initialization files, resulting in failure to upload images

WBOY
Release: 2016-07-06 13:52:59
Original
1109 people have browsed it

在ueditor/php/controller.php中定义图片上传目录之后
如果引入初始化文件却无法上传文件,提示服务器返回错误

Baidu Editor introduces website initialization files, resulting in failure to upload images

附网站初始化文件

<code><?php
header("content-type:text/html;charset=utf-8");

// 定义错误级别
define("DEBUG",true);
if(defined("DEBUG") && DEBUG){
    error_reporting(11);
}else{
    error_reporting(0);
}

// 获取网站根目录
define("ROOT_PATH",str_replace(array('\\','init.php'),array('/',''),__FILE__));

// 获取网站域名
define("URL","http://".$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'],'/',ROOT_PATH));

// 防止非法访问
if(!defined("IN_WEB360")){
    header("Location:".URL."index.php?c=error");
    exit;
}

// 自动加载
function  __autoload($class){
    if(stripos($class,"Model")!==false){
        require_once ROOT_PATH."models/{$class}.php";
    }else if(stripos($class,'Controller')!==false){
        if(isset($_GET['s']) && $_GET['s']=="admin"){
            require_once ROOT_PATH."controllers/admin/{$class}.php";
        }else{
            require_once ROOT_PATH."controllers/{$class}.php";
        }
    }else{
        require_once ROOT_PATH."lib/{$class}.class.php";
    }
}
</code>
Copy after login
Copy after login

求解!谢谢诸位

回复内容:

在ueditor/php/controller.php中定义图片上传目录之后
如果引入初始化文件却无法上传文件,提示服务器返回错误

Baidu Editor introduces website initialization files, resulting in failure to upload images

附网站初始化文件

<code><?php
header("content-type:text/html;charset=utf-8");

// 定义错误级别
define("DEBUG",true);
if(defined("DEBUG") && DEBUG){
    error_reporting(11);
}else{
    error_reporting(0);
}

// 获取网站根目录
define("ROOT_PATH",str_replace(array('\\','init.php'),array('/',''),__FILE__));

// 获取网站域名
define("URL","http://".$_SERVER['HTTP_HOST'].str_replace($_SERVER['DOCUMENT_ROOT'],'/',ROOT_PATH));

// 防止非法访问
if(!defined("IN_WEB360")){
    header("Location:".URL."index.php?c=error");
    exit;
}

// 自动加载
function  __autoload($class){
    if(stripos($class,"Model")!==false){
        require_once ROOT_PATH."models/{$class}.php";
    }else if(stripos($class,'Controller')!==false){
        if(isset($_GET['s']) && $_GET['s']=="admin"){
            require_once ROOT_PATH."controllers/admin/{$class}.php";
        }else{
            require_once ROOT_PATH."controllers/{$class}.php";
        }
    }else{
        require_once ROOT_PATH."lib/{$class}.class.php";
    }
}
</code>
Copy after login
Copy after login

求解!谢谢诸位

可以通过Chrome查看Ueditor的Ajax请求结果,如果是代码错误一般会返回错误码“500”,而且会有错误信息。
Baidu Editor introduces website initialization files, resulting in failure to upload images

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template