Home  >  Article  >  Backend Development  >  百度编辑器引入网站初始化文件导致无法上传图片

百度编辑器引入网站初始化文件导致无法上传图片

WBOY
WBOYOriginal
2016-07-06 13:52:591038browse

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

百度编辑器引入网站初始化文件导致无法上传图片

附网站初始化文件

<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></code>

求解!谢谢诸位

回复内容:

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

百度编辑器引入网站初始化文件导致无法上传图片

附网站初始化文件

<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></code>

求解!谢谢诸位

可以通过Chrome查看Ueditor的Ajax请求结果,如果是代码错误一般会返回错误码“500”,而且会有错误信息。
百度编辑器引入网站初始化文件导致无法上传图片

Statement:
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