这两天调试FA发现后台可以正常使用的CXSELECT前台无法获取数据,经过调试发现,原来前台少了城市数据的调取,具体修正步骤:
1.在applocation/index/controller/ajax.php中加入
/**
* 读取省市区数据,联动列表 */public function area(){ $params = $this->request->get("row/a"); if (!empty($params)) { $province = isset($params['province']) ? $params['province'] : ''; $city = isset($params['city']) ? $params['city'] : null; } else { $province = $this->request->get('province'); $city = $this->request->get('city'); } $where = ['pid' => 0, 'level' => 1]; $provincelist = null; if ($province !== '') { if ($province) { $where['pid'] = $province; $where['level'] = 2; } if ($city !== '') { if ($city) { $where['pid'] = $city; $where['level'] = 3; } $provincelist = Db::name('area')->where($where)->field('id as value,name')->select(); } } $this->success('', null, $provincelist);}
2.在该文件头部添加如下代码
use thinkConfig;
use thinkDb;
use thinkValidate;
完成后即可正常调用了!
希望以上内容对你有所帮助!如果还有其他问题,请随时提问。 各类知识收集 拥有多年CMS企业建站经验,对 iCMS, Fastadmin, ClassCMS, LeCMS, PbootCMS, PHPCMS, 易优CMS, YzmCMS, 讯睿CMS, 极致CMS, Wordpress, HkCMS, YznCMS, WellCMS, ThinkCMF, 等各类cms的相互转化,程序开发,网站制作,bug修复,程序杀毒,插件定制都可以提供最佳解决方案。