Kategori produk baharu
CateController.class.php🎜 controller🎜 🎜🎜#<?php
namespace Admin\Controller;
use Think\Controller;
class CateController extends CommonController
{
public function index(){
$this->display();
}
public function add(){
$cate=D('Cate');
if (IS_POST) {
if($cate->create()){
if ($cate->add()) {
$this->success('添加商品分类成功',U('Cate/add'));
}else{
$this->error('添加商品分类失败!');
}
}else{
$this->error($cate->getError());
}
return;
}
$cateres=$cate->select();
$this->assign('cateres',$cateres);
$this->display();
}
}
CommonController terus mewarisi pengawal biasa #🎜🎜🎜🎜🎜🎜🎜 #$cateres=$cate->select();
$this->assign('cateres',$cateres);
diberikan kepada kategori templat.
<?php namespace Admin\Model; use Think\Model; class CateModel extends Model { protected $_validate = array( array('catename','require','管理员名称不得为空!',1), ); }#🎜🎜🎜🎜🎜#Tambah kategori Tiada nama ditambah Serah
#🎜#
#🎜##🎜##🎜 🎜## 🎜🎜#pengesahan sah
#🎜🎜🎜🎜🎜bahagian seterusnya