分类

 <select name="" class="input-xlarge" id="cate_one">
                            <option value="">请选择一级分类</option>
                              {foreach $cate as $cate_one}
                            <option value="{$cate_one.id}">{$cate_one.cate_name}</option>
                            {/foreach}
                        </select>
                        <select name="" class="input-xlarge" id="cate_two">
                            <option value="">请选择二级分类</option>
                        </select>
                        <select name="cate_id" class="input-xlarge" id="cate_three">
                            <option value="">请选择三级分类</option>
                        </select>

public function getCateByPid(KaTeX parse error: Expected '}', got 'EOF' at end of input: …id参数 //id = request()->param(‘id’);
//检测id参数
if(!preg_match(’/^\d+$/’, $id)){
//id参数格式错误
r e s = [ ′ c o d e ′ = &gt; 10001 , ′ m s g ′ = &gt; ′ 参 数 错 误 ′ ] ; r e t u r n j s o n ( res = [ &#x27;code&#x27; =&gt; 10001, &#x27;msg&#x27; =&gt; &#x27;参数错误&#x27; ]; return json( res=[code=>10001,msg=>];returnjson(res);
}
//根据分类id查询 其 子分类
$data = \app\admin\model\Category::where(‘pid’, $id)->select();
//返回数据
$res = [
‘code’ => 10000,
‘msg’ => ‘success’,
‘data’ => d a t a ] ; r e t u r n j s o n ( data ]; return json( data];returnjson(res);
}



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值