Home  >  Article  >  php教程  >  CI Framework Notes 6

CI Framework Notes 6

黄舟
黄舟Original
2016-12-29 09:43:071246browse

<?php

//删除

$this->db->delete(&#39;cate&#39;,array(&#39;cid&#39;= >$cid));

//limit

$this->db->limit(3)->get(&#39;cate&#39;)->result_array();

/**

*对某个方法开启调试模式

*/

$this->output->enable_profiler(TRUE);

?>

<?php

//文章首页查询

public function check(){

$this->db->select(&#39;aid,thumb,title,info&#39;)->order_by(&#39;time&#39;,&#39;desc&#39;)->get_where(&#39;article&#39;,array(&#39;type&#39;=>0))->result_array();

}

?>

<?php

//获取文章的标题

public function title(){

$this->db->select(&#39;title,aid&#39;)->order_by(&#39;time&#39;,&#39;desc&#39;)->get(&#39;article&#39;)->result_array();

}

?>

/**

* 在模板中载入其他视图

*/

可以直接使用:

<?php $this->db->load->view(&#39;index/head.html&#39;)?>

<?php $this->db->load->view(&#39;index/right.html&#39;)?>

<?php $this->db->load->view(&#39;index/footer.html&#39;)?>

/**

* 取出URL片段

*/

<?php

$this -> uri -> segment(4);

?>

//通过aId获取文章

<?php

public function aid_article($aid){

$data=$this->db->where(&#39;aid&#39;,$aid)->get(&#39;article&#39;)->result_array();

} 

//通过aId获取文章

public function aid_article($aid){

$data=$this->db->join(&#39;category&#39;,&#39;article.cid=category.cid&#39;)->get_where(&#39;article&#39;,array(&#39;aid&#39;=>$aid))->result_array();

return $data;

}

?>

/**

* 是银行构造函数自动载入共同的model 

*/

public function __contruct(){

parent::__contruct();

$this->load->model(&#39;article_model&#39;,&#39;art&#39;);

$this->laod->model(&#39;category_model&#39;,&#39;cate&#39;);

}

The above is the content of CI Framework Note 6. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:CI Framework Notes 5Next article:CI Framework Notes 5