1,
<input type="radio" name="type" value="0" <?php echo set_radio('type','0',TRUE)?> />普通 <input type="radio" name="type" value="0" <?php echo set_radio('type','0',TRUE)?>/>情感
2,
<select name="cid" id=""> <option value="1" <?php echo set_select('cid','1',TRUE)?>>情感</option> 注意:TRUE意思是默认选中的;1是值 <option value="0" <?php echo set_select('cid','2')?>>生活</option> </select>
3,
<a href=" <?php echo site_url('admin/admin/index')?>">
4, Operation database model
//添加动作 public function add(){ $this->load->library("form_validation"); $status = $this->form_validation->run('cate'); if($status){ //操作模型; $this -> load -> model( "category_model" ); model( "category_model","cate");给模型起个别名 $data = array( ' cname' => $_POST['cname'], ); $this -> category_model -> add($data); //执行到模型中的添加方法 }else{ $this->load->helper("form"); $this -> load->view(" admin/add_cate.html"); } //注意:模型model是建在application/models/的这个目录下面; <?php //栏目管理模型 配置数据库是在 application/config/database.php去配置下 此处时model层 class Category_model extends CI_Model { //添加 public function add ($data){ //使用AR模型 $this -> db -> insert('category',$data); } } ?> } /** * 开启AR模型 一般文章管理系统会使用到AR模型 */ $active_record = TRUE; //可以直接在控制器中$this -> db -> insert();
5, When an error occurs, the return method of bool input class is safer to use.
$this -> input -> post("abc"); 以post的方式接收 $this -> input -> get("abc"); 以get的方式接收 ¥this -> input -> server("name");
6. The global function is edited and defined in system/core/common.php
7 , Function definition in common.php
//定义成功的提示函数 function success($url , $msg){ heard('Content-type:text/html;charset=utf-8'); $url = site_url($url); echo "<script type='text/javascript'>alert('$msg');location.hrerf='$url'</script>"; die; } function error($msg){ heard('Content-type:text/html;charset=utf-8'); echo "<script type='text/javascript'>window.history.back();</script>"; }
8, Debug mode
$this -> output -> enable_profiler(TRUE);
The above is the content of CI Framework Note 2, more related Please pay attention to the PHP Chinese website (www.php.cn) for content!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver CS6
Visual web development tools
