<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
′
=
>
10001
,
′
m
s
g
′
=
>
′
参
数
错
误
′
]
;
r
e
t
u
r
n
j
s
o
n
(
res = [ 'code' => 10001, 'msg' => '参数错误' ]; 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);
}