模型某函数怎么调用其他函数?
比如编辑文章的时候.需要调用查询栏目的函数//编辑新闻
function arc_edit($id)
{
$query=$this->db->get_where('article',array('id' => $id));
$row=$query->row_array();
search_type();
return $row;
}
//查询栏目
function search_type()
{
$type_arr=array();
$this->db->select('typeid,typename');
$query=$this->db->get('arctype');
if($query->num_rows()>0)
{
foreach($query->result() as $row)
{
$type_arr[$row->typeid]=$row->typename;
}
}
return $type_arr;
}
直接调用search_type();不行,
还有一个问题我在模型查询数据后每次都要return才能把数据返回到C操作? http://servers.pconline.com.cn/skills/0709/1100374.html
好好看看...都是基础啊... 我会好好看的.就是太多东西没学到.到处出问题 对类的方法调用(学JAVA会很有体会)
必然是在有具体对象的情况下。即使是类方法。也要用类访问。 \到现在我觉得我还是在面向过程进行编写 哎!!!!!!!!! 用$this->search_type();调用呀
页:
[1]