<?php
namespace Admin\Controller;
use Think\Controller;
class TypeController extends Controller {
	//加载栏目列表页面
    public function showlist(){
        $this->display();
    }
    //加载添加栏目页面
   public function tianjia(){
     if(IS_POST){
        $data['typename']=I('typename');
        $type=D('type');
        if($type->create($data)){
        if($type->add($data)){
            $this->success('栏目添加成功',U('showlist'),2);
        }
      
        else{
            $this->error('栏目添加失败');
        }}
        else{
            $this->error($type->getError());
        }
        return;
    }

     $this->display();
    }
    
    //加载修改栏目页面
     public function xiugai(){
        $this->display();
    }
   
}

  Model代码

<?php
namespace Admin\Model;
use Think\Model;
class TypeModel extends Model  {
    protected $_validate=array(
        array('typename','require','栏目名称不能为空'),



        );
	
}

  

相关文章:

  • 2021-09-16
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2021-06-30
  • 2022-01-30
  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案