【发布时间】:2015-02-13 19:57:12
【问题描述】:
我在应用程序/核心文件夹中创建了一个名为 MY_Library 的核心库,我正在尝试从应用程序/库中的库类扩展它,但不幸的是它找不到该文件。
//application/core/My_Library.php
class My_Library{
function __construct(){
}
/**
* This is the generic function that calls php curl to make a query.
* @param $url
* @param array $data
* @param string $type
* @return mixed|string
*/
public function callService($url,$data=array(),$type="get"){
if (strtolower($type) == "get"){
$url .= "?".http_build_query($data);
$response = $this->doGet($url);
}else if (strtolower($type) == "post"){
$fields_string = http_build_query($data);
$response = $this->doPost($url,$fields_string);
}else{
$response = "INVALID REQUEST";
}
return $response;
}
}
In my application/libraries
class CakePixel extends MY_Library{
function __construct(){
parent::__construct();
}
public function fireCakePixel($cakeOfferId,$reqId,$transactionId){
$cakeUrl = "http://oamtrk.com/p.ashx";
$param = array(
"o" => $cakeOfferId,
"reqid" =>$reqId,
"t" => $transactionId
);
$response = $this->callService($cakeUrl,$param,"get");
}
}
但是我遇到了一个致命错误
PHP Fatal error: Class 'MY_Library' not found in /application/libraries/cakeApi/pixel/CakePixel.php on line 10, referer:
如果可能,我如何在不使用 require_once 或包含类文件的情况下解决此问题。
【问题讨论】:
标签: php codeigniter