Problem in accessing function of a class
Here is my index.php in this suppose i am calling the command getresellers
it calls the getresellers
function of Reseller
class
$_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();
开发者_Go百科 // echo Config::json_format($msg);
// exit;
break;
default :
}
function __autoload($class_name) {
include $class_name . '.php';
}
Here is my Reseller Class which want to call the ResellerDashBoard Class function But the error is coming
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);
}
}
The error coming is
<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 />
Please suggest what best should i do to access the Reseller DashBoard Function ?
First problem should be strikingly obvious. "include(ResellerDashBoard.php) failed to open stream: No such file or directory"... Ensure that the files are where they should be... in your current working directory, or specify a full filepath in your autoloader.
Then check that the current working directory is that folder using getcwd()
Failing that, check file permissions/privileges.
精彩评论