这是我的index.php,假设我调用command getresellers
它调用getresellers
类的Reseller
函数
$_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 :(得分:0)
第一个问题应该是非常明显的。 “include(ResellerDashBoard.php)无法打开流:没有这样的文件或目录”......确保文件位于当前工作目录中...或者在自动装带器中指定完整的文件路径。
然后使用getcwd()
检查当前工作目录是否为该文件夹如果失败,请检查文件权限/权限。