2011-03-17 44 views
0

這裏的功能是我在這個假設的index.php我打電話的command getresellers它調用的函數getresellersReseller問題在訪問類

$_command=$_REQUEST['_command']; 
$dbs = new Databases(); 

switch($_command) 
{ 
    case 'getresellerscount' : 
     $rd=new Resellerdashboard($dbs); 
     echo $msg=$rd->getresellerscount(); 
     // echo Config::json_format($msg); 
     // exit; 
     break; 
    case 'getresellers' : 
     $rd=new Reseller($dbs); 
     echo $msg=$rd->getresellers(); 
     // echo Config::json_format($msg); 
     // exit; 
     break; 
    default : 
} 

function __autoload($class_name) { 
    include $class_name . '.php'; 
} 

這裏是我的經銷商類要撥打的ResellerDashBoard類功能,但錯誤是未來

Class Reseller 
{ 
    private $dbs; 

    public function __construct(Databases $dbs) 
    { 
     $this->dbs = $dbs; 
    } 
    /** 
    * 
    * function for getting resellers 
    * 
    **/ 
    public function getresellers() 
    { 
     list($fromdate,$todate)=ResellerDashBoard::getdate(); 
     $data_query=" 
      SELECT firstname,lastname,mobile,email,tmecode,tmename,updatedon,apptype,alloctype,empparent 
      from tbl_reseller_dashboard_intermediate 
      where empparent='".$_GET['city']."' ".$condition." 
       and updatedon>='".$_REQUEST['fromdate']." 00:00:00' and updatedon<='".$_REQUEST['todate']." 23:59:59' "; 

     $result=$this->dbs->resellerdashboarddb->getResult($city);   



    } 
} 

錯誤到來是

<br /> 
<b>Warning</b>: include(ResellerDashBoard.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in <b>/home/abhijitnair/sandbox/newresellerdashboard/api/index.php</b> on line <b>38</b><br /> 
<br /> 
<b>Warning</b>: include() [<a href='function.include'>function.include</a>]: Failed opening 'ResellerDashBoard.php' for inclusion (include_path='.:/usr/local/lib/php') in <b>/home/abhijitnair/sandbox/newresellerdashboard/api/index.php</b> on line <b>38</b><br /> 
<br /> 
<b>Fatal error</b>: Class 'ResellerDashBoard' not found in <b>/home/abhijitnair/sandbox/newresellerdashboard/api/Reseller.php</b> on line <b>45</b><br /> 

請建議我應該怎樣做才能訪問經銷商DashBoard功能?

+0

第一個問題應該是顯而易見的。 「include(ResellerDashBoard.php)未能打開流:沒有這樣的文件或目錄」...確保文件應該放在當前的工作目錄中......或者在自動加載器中指定完整的文件路徑 – 2011-03-17 12:31:44

+0

文件是否有文件夾 – XMen 2011-03-17 12:33:41

+0

然後使用getcwd()檢查當前工作目錄是否爲該文件夾...您收到的錯誤消息非常明確 – 2011-03-17 12:35:15

回答

0

第一個問題應該是顯而易見的。 「include(ResellerDashBoard.php)未能打開流:沒有這樣的文件或目錄」...確保文件應該放在當前的工作目錄中,或者在自動加載器中指定完整的文件路徑。

然後,檢查當前的工作目錄是使用文件夾GETCWD()

做不到這一點,請檢查文件權限/特權。