【发布时间】:2012-01-31 04:40:51
【问题描述】:
我为 API 访问创建了一个库,并为该库使用的常用函数创建了一个单独的帮助程序。在 codeigniter 中,新库可以通过使用...创建自己的实例来访问本机类。
$example_instance = & get_instance();
我这样做了,加载了我的助手-但每次调用助手函数时,我都会收到“尝试访问非对象”错误。我究竟做错了什么?
这就是我所拥有的
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class api_example {
private $api;
public function __construct(){
$this->api = & get_instance();
$this->api->load->helper('helper_test');
}
public function search_recent($param){
$string = $this->api->helper_test->connect($url); //error!!!
return $xml;
}
}
/* End of file */
【问题讨论】:
-
作为预防措施.. 是名为“helper_test”的帮助文件.. 标点符号确实是我所追求的。似乎没有加载帮助文件。
-
我们可以看看你的
helper_test代码吗?
标签: codeigniter helper