ford123 发表于 2017-3-1 13:54:12

写了一个接口,偶尔会出现这个错误

Warning: file_exists(): open_basedir restriction in effect. File(我的域名路径/appapi/application/core/Exceptions.php) is not within the allowed path(s): (.:/tmp/) in 我的域名路径/appapi/system/core/Common.php on line 157

Warning: file_exists(): open_basedir restriction in effect. File(我的域名路径/appapi/system/core/Exceptions.php) is not within the allowed path(s): (.:/tmp/) in 我的域名路径/appapi/system/core/Common.php on line 157

Warning: file_exists(): open_basedir restriction in effect. File(我的域名路径/appapi/application/core/MY_Exceptions.php) is not within the allowed path(s): (.:/tmp/) in 我的域名路径/appapi/system/core/Common.php on line 171

Warning: Cannot modify header information - headers already sent by (output started at 我的域名路径/appapi/application/controllers/Ncb_xcx.php:73) in 我的域名路径/appapi/system/core/Common.php on line 578
Unable to locate the specified class: Exceptions.php

以上是偶尔出现的警告信息,请问是哪里出现了问题?

Hex 发表于 2017-3-1 18:56:56

错误提示很清楚,应该是你的代码或者 CI 配置的问题,贴 Ncb_xcx.php 的代码看看。

ford123 发表于 2017-3-2 16:01:23

Hex 发表于 2017-3-1 18:56
错误提示很清楚,应该是你的代码或者 CI 配置的问题,贴 Ncb_xcx.php 的代码看看。 ...

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Ncb_xcx extends CI_Controller{

    public function __construct(){
      parent::__construct();
      $this->load->model('Ncb_xcx_m');
    }

    /**
   * @param $catid
   * @param $page
   * @param string $callback
   */
    public function lists($catid,$page){
      $data = $this->Ncb_xcx_m->list_m_n($catid,$page);
      $this->common_json($data);
      exit;
    }

    private function common_json($data){
      //没带callback参数,返回json数据格式
      $callback = isset($_GET['callback'])?$_GET['callback']:'json';
      if($callback == 'array'){
            print_r($data);
      }elseif($callback == 'json'){
            echo json_encode($data);
      }else{
            echo $callback.'('.json_encode($data).')';
      }
    }

}

Hex 发表于 2017-3-2 18:01:45

ford123 发表于 2017-3-2 16:01

73 行是哪个?另外你是不是改了 index.php ?重新下载一个 CI 试试

ford123 发表于 2017-3-3 14:27:10

Hex 发表于 2017-3-2 18:01
73 行是哪个?另外你是不是改了 index.php ?重新下载一个 CI 试试

有些无关的方法我删除了,73行是这个:echo $callback.'('.json_encode($data).')';

ford123 发表于 2017-3-3 14:28:25

Hex 发表于 2017-3-2 18:01
73 行是哪个?另外你是不是改了 index.php ?重新下载一个 CI 试试

index.php没有修改,如果找不出错误,那就在下载一个试试!可是,这个错误是偶尔出现的。

Hex 发表于 2017-3-3 15:19:07

ford123 发表于 2017-3-3 14:28
index.php没有修改,如果找不出错误,那就在下载一个试试!可是,这个错误是偶尔出现的。 ...

偶尔出现的啊,我看你的代码貌似没有问题,如果是偶尔出现的,那应该和服务器有点关系,具体什么问题目前不好说。
页: [1]
查看完整版本: 写了一个接口,偶尔会出现这个错误