새 제품 카테고리 추가

New 제품 카테고리 ewcatecontroller.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는 템플릿 분류에 할당 된 공개 컨트롤러를 계속 상속합니다.

CateModel.class.php

$cateres=$cate->select();
$this->assign('cateres',$cateres);
카테고리 추가 시도

QQ截图20170623115112.png

이름을 추가하지 않고 제출

QQ截图20170623112918.png

QQ截图20170623112950.png

QQ截图20170623115101.png

확인 소요 시간 효과

QQ截图20170623113116.png

지속적인 학습
||
<!DOCTYPE html> <html><head> <meta charset="utf-8"> <title>PHP中文网</title> <meta name="description" content="Dashboard"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!--Basic Styles--> <link href="__PUBLIC__/style/bootstrap.css" rel="stylesheet"> <link href="__PUBLIC__/style/font-awesome.css" rel="stylesheet"> <link href="__PUBLIC__/style/weather-icons.css" rel="stylesheet"> <!--Beyond styles--> <link id="beyond-link" href="__PUBLIC__/style/beyond.css" rel="stylesheet" type="text/css"> <link href="__PUBLIC__/style/demo.css" rel="stylesheet"> <link href="__PUBLIC__/style/typicons.css" rel="stylesheet"> <link href="__PUBLIC__/style/animate.css" rel="stylesheet"> </head> <body> <!-- 头部 --> <include file="Common/header" /> <!-- /头部 --> <div class="main-container container-fluid"> <div class="page-container"> <!-- Page Sidebar --> <include file="Common/left" /> <!-- /Page Sidebar --> <!-- Page Content --> <div class="page-content"> <!-- Page Breadcrumb --> <div class="page-breadcrumbs"> <ul class="breadcrumb"> <li> <a href="#">系统</a> </li> <li> <a href="#">用户管理</a> </li> <li class="active">添加商品分类</li> </ul> </div> <!-- /Page Breadcrumb --> <!-- Page Body --> <div class="page-body"> <div class="row"> <div class="col-lg-12 col-sm-12 col-xs-12"> <div class="widget"> <div class="widget-header bordered-bottom bordered-blue"> <span class="widget-caption">新增商品分类</span> </div> <div class="widget-body"> <div id="horizontal-form"> <form class="form-horizontal" role="form" action="" method="post"> <div class="form-group"> <label for="username" class="col-sm-2 control-label no-padding-right">分类名称</label> <div class="col-sm-6"> <input class="form-control" id="catename" name="catename" type="text"> </div> <p class="help-block col-sm-4 red">* 必填</p> </div> <div class="form-group"> <label for="group_id" class="col-sm-2 control-label no-padding-right">上级分类</label> <div class="col-sm-6"> <select name="pid" style="width: 100%;"> <option value="0">顶级分类</option> <volist id="vo" name="cateres"> <option value="{$vo.id}">{$vo.catename}</option> </volist> </select> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-10"> <button type="submit" class="btn btn-default">保存信息</button> </div> </div> </form> </div> </div> </div> </div> </div> </div> <!-- /Page Body --> </div> <!-- /Page Content --> </div> </div> <!--Basic Scripts--> <script src="__PUBLIC__/style/jquery_002.js"></script> <script src="__PUBLIC__/style/bootstrap.js"></script> <script src="__PUBLIC__/style/jquery.js"></script> <!--Beyond Scripts--> <script src="__PUBLIC__/style/beyond.js"></script> </body> </html>
  • 코스 추천
  • 코스웨어 다운로드
현재 코스웨어를 다운로드할 수 없습니다. 현재 직원들이 정리하고 있습니다. 앞으로도 본 강좌에 많은 관심 부탁드립니다~