如何用PHP AJAX MySQL实现三级联动查询并构建长尾?
- 内容介绍
- 文章标签
- 相关推荐
本文共计200个文字,预计阅读时间需要1分钟。
php三级联动 + PHP: public function getCity(){ $ParentId=I('post.ParentId'); $current_city=M('citys')->where(ParentId='{$ParentId}')->select(); $data['data']=$current_city; $this->assign('area', $data); $this->display();}
三级联动php: where('ParentId=1')->select(); $this->assign('area',$area); $this->display(); } public function getCity(){ $ParentId=I('post.ParentId'); $current_city=M('citys')->where('ParentId='.$ParentId)->select(); $data['data']=$current_city; $this->ajaxReturn($data); } public function getCounty(){ $ParentId=I('post.ParentId'); $current_county=M('citys')->where('ParentId='.$ParentId)->select(); $data['data']=$current_county; $this->ajaxReturn($data); } } html:
三级联动
本文共计200个文字,预计阅读时间需要1分钟。
php三级联动 + PHP: public function getCity(){ $ParentId=I('post.ParentId'); $current_city=M('citys')->where(ParentId='{$ParentId}')->select(); $data['data']=$current_city; $this->assign('area', $data); $this->display();}
三级联动php: where('ParentId=1')->select(); $this->assign('area',$area); $this->display(); } public function getCity(){ $ParentId=I('post.ParentId'); $current_city=M('citys')->where('ParentId='.$ParentId)->select(); $data['data']=$current_city; $this->ajaxReturn($data); } public function getCounty(){ $ParentId=I('post.ParentId'); $current_county=M('citys')->where('ParentId='.$ParentId)->select(); $data['data']=$current_county; $this->ajaxReturn($data); } } html:

