CI框架随记5
程序员文章站
2022-05-06 14:06:48
...
<?php echo base_url(); echo base_url().'index'; public function article(){ } echo site_url().'style/index'; class Admin extends CI_Controller { public function index(){ $this->load->view('admin/index.html'); } //默认欢迎 public function copy(){ $this->load->view('login/index.html'); } //发表模板显示 public function send_article(){ //载入辅助函数 $this->load->helper(''); $this->load->view('aricle/article.html'); } //发表文章的动作 public function send(){ //载入表单验证类 $this->load->library('form_validation'); //设置验证规则 $this->form_validation->set_rules('title','文章标题','require|min_length[5]'); $this->form_validation->set_rules('type','类型','require|integer'); $this->form_vadition //执行验证 $status = $this->form_validation->run(); if($status){ echo '数据库操作'; }else{ $this->load->helper('form'); $this->load->view('admin\article.html'); } } /** *编辑文章 */ public function edit_article{ $this->load->helper('form'); $this->load->view(''); } //编辑动作 public function edit(){ $this->load->library('form_validation'); $status = $this->form_validation->run('article'); } } ?> <?php echo base_url().'/style/admin/css/public.css'; ?> <?php echo site_url(''); /** *在模板上输出设定的值 */ <input type="text" name="cname" value="<?php echo set_value('cname')?>" /> ?> <?php <form action="<?php site_url('admin/category/add')?>"></form> ?>
以上就是CI框架随记5的内容,更多相关内容请关注PHP中文网(www.php.cn)!