CI $this 疑惑???
ci 中 $this->c->getfaction("test","true");这里的c 是什么含义??????c 是CI的类库 这个 C 应该是代码里自己写的,不是 CI 里的东西。 本帖最后由 jions7ihj 于 2015-8-31 14:12 编辑
我找了,没找到啊,,,,,c 本来是当前类的成员数据么,,,但是类里就是没有定义过, 也許你可以提供該文件的所有代碼
我們才能幫你發現出處 jions7ihj 发表于 2015-8-31 14:10
我找了,没找到啊,,,,,c 本来是当前类的成员数据么,,,但是类里就是没有定义过, ...
代码打包发上来。
晚上吧.... 这个$this->c肯定是你全局初始化的时候定义了一个,比如在一个公共模型里面做了这个步骤:
public $c;
public function __construct()
{
parent::__construct();
$this->load->model('config_model');
$CI =& get_instance();
$CI->c = $this->config_model;
} Hex 发表于 2015-8-31 14:44
代码打包发上来。
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class About_model extends CI_Model
{
const article = 'article'; // 文章
const category = 'article_category'; // 文章分类
const announcement = 'announcement'; // 公告
/**
* 获取内容详情
*
* @access public
* @return array
*/
public function get_detail_info()
{
$data = $temp = array();
$temp['type'] = $this->input->get('type', TRUE);
$temp['id'] = (int)$this->input->get('id');
if( ! empty($temp['type']) && ! empty($temp['id']))
{
$temp['table'] = ($temp['type'] != 'announcement') ? self::article : self::announcement;
$temp['where'] = array('where' => array('id' => $temp['id']));
$data = $this->c->get_row($temp['table'], $temp['where']);
$data['act']= $temp['type'];
$data['name'] = ($temp['type'] != 'announcement') ? '文章详情' : '公告详情';
}
unset($temp);
return $data;
}
/**
* 获取帮助中心文章列表
*
* @access public
* @return array
*/
public function get_article_list()
{
$data = $temp = array();
$temp['where'] = array(
'select' => 'cat_id,category',
'where' => array('parent_id' => 2),
'order_by' => 'sort_order desc,cat_id desc'
);
$data = $this->c->get_all(self::category, $temp['where']);
if( ! empty($data))
{
$temp['cat_id'] = array();
foreach($data as $v)
{
$temp['cat_id'][] = $v['cat_id'];
}
$temp['where'] = array(
'select' => 'id,title,cat_id,content',
'where_in' => array(
'field' => 'cat_id',
'value' => $temp['cat_id']
)
);
$temp['data'] = $this->c->get_all(self::article, $temp['where']);
foreach($data as $key => $val)
{
foreach($temp['data'] as $k => $v)
{
if($v['cat_id'] == $val['cat_id'])
{
$data[$key]['article'][] = $v;
}
}
}
}
unset($temp);
return $data;
}
}
这是类的源码....
jions7ihj 发表于 2015-9-1 08:51
这是类的源码....
代码不全,明显没有定义 c 的地方。
把代码目录压缩后传上来。
页:
[1]