本文整理匯總了PHP中Site::getProvince方法的典型用法代碼示例。如果您正苦於以下問題:PHP Site::getProvince方法的具體用法?PHP Site::getProvince怎麽用?PHP Site::getProvince使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Site
的用法示例。
在下文中一共展示了Site::getProvince方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: listInfo
private function listInfo($pro_code, $city_code, $area_code, $public_type, $keyword, $sort, $page_id = 1)
{
//所有省份
$site = new \Site();
$provinces = $site->getProvince();
$provinces[0]['name'] = '不限';
foreach ($provinces as $key => $val) {
$provinces[$key]['url'] = "/child-{$val['code']}-0-0-{$public_type}-{$sort}?key=" . urlencode($keyword);
}
//當前省份名稱
if ($pro_code == 0) {
$pro_name = '不限';
} else {
$pro_name = $site->getProName($pro_code);
$pro_name = empty($pro_name) ? '未知' : $pro_name;
}
//對應城市
$cities = $site->getCity($pro_code);
$cities[0]['name'] = '不限';
foreach ($cities as $key => $val) {
$cities[$key]['url'] = "/child-{$pro_code}-{$val['code']}-0-{$public_type}-{$sort}?key=" . urlencode($keyword);
}
//當前城市名稱
if ($city_code == 0) {
$city_name = '不限';
} else {
$city_name = $site->getCityName($city_code);
$city_name = empty($city_name) ? '未知' : $city_name;
}
//對應區縣
$areas = $site->getArea($city_code);
$areas[0]['name'] = '不限';
foreach ($areas as $key => $val) {
$areas[$key]['url'] = "/child-{$pro_code}-{$city_code}-{$val['code']}-{$public_type}-{$sort}?key=" . urlencode($keyword);
}
//當前區縣名稱
if ($area_code == 0) {
$area_name = '不限';
} else {
$area_name = $site->getAreaName($area_code);
$area_name = empty($area_name) ? '未知' : $area_name;
}
//性質
$public = \Setting::getPublic();
unset($public['-1']);
array_unshift($public, '不限');
foreach ($public as $key => $val) {
$public[$key] = ['name' => $val, 'url' => "/child-{$pro_code}-{$city_code}-{$area_code}-{$key}-{$sort}?key=" . urlencode($keyword)];
}
//排序
$order = [1 => '熱度', 2 => '好評'];
foreach ($order as $key => $val) {
$order[$key] = ['name' => $val, 'url' => "/child-{$pro_code}-{$city_code}-{$area_code}-{$public_type}-{$key}?key=" . urlencode($keyword)];
}
//獲取大學列表
$list = (new \School())->getChildList($pro_code, $city_code, $area_code, $public_type, $keyword, $sort, $page_id);
$page_html = $this->pageHtml($list['page']);
return ['list' => $list['list'], 'page' => $list['page'], 'page_html' => $page_html, 'provinces' => $provinces, 'pro_code' => $pro_code, 'pro_name' => $pro_name, 'cities' => $cities, 'city_code' => $city_code, 'city_name' => $city_name, 'areas' => $areas, 'area_code' => $area_code, 'area_name' => $area_name, 'public' => $public, 'public_type' => $public_type, 'keyword' => $keyword, 'order' => $order, 'sort' => $sort];
}
示例2: listAction
public function listAction()
{
if ($this->request->isAjax()) {
$id = (int) (new \Validate())->getPost('id');
if ($id == 0) {
$this->end(404);
}
$this->end((new \Train())->delTrain($id, $this->session->get('id')));
}
//當前頁碼
$page_id = (int) $this->request->getQuery('page');
$page_id = $page_id < 1 ? 1 : $page_id;
//省份code
$pro_code = (int) $this->request->getQuery('pro_code');
//城市code
$city_code = (int) $this->request->getQuery('city_code');
//區縣code
$area_code = (int) $this->request->getQuery('area_code');
//關鍵字
$keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
//關鍵字長度小於10,並且隻能是字符數字中文
//每頁顯示條數
$limit = 20;
//省市區縣
$site = new \Site();
$provinces = $site->getProvince();
//省
$cities = $site->getCity($pro_code);
//城市
$areas = $site->getArea($city_code);
//區縣
//查詢數據
$train = new \Train();
//獲取分類
$category = $train->getCategory();
$list = $train->getList($page_id, $limit, $pro_code, $city_code, $keyword);
//數據
$page_html = $this->pageHtml($list['page']);
//分頁html
//加載js
$this->assets->addJs('backend/mt/train-list.js');
$this->view->setVars(['pro_code' => $pro_code, 'city_code' => $city_code, 'area_code' => $area_code, 'category' => $category, 'keyword' => $keyword, 'provinces' => $provinces, 'cities' => $cities, 'areas' => $areas, 'list' => $list['list'], 'page_html' => $page_html]);
}
示例3: listAction
public function listAction()
{
if ($this->request->isAjax()) {
$validate = new \Validate();
$id = (int) $validate->getPost('id');
if (!$id) {
$this->end(404);
}
$this->end((new \College())->delCollege($id, $this->session->get('id')));
}
//當前頁碼
$page_id = (int) $this->request->getQuery('page');
$page_id = $page_id < 1 ? 1 : $page_id;
//省份code
$pro_code = (int) $this->request->getQuery('pro_code');
//城市code
$city_code = (int) $this->request->getQuery('city_code');
//性質
$col_type = (int) $this->request->getQuery('col_type');
//關鍵字
$keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
//關鍵字長度小於10,並且隻能是字符數字中文
//每頁顯示條數
$limit = 20;
//省市區縣
$site = new \Site();
$provinces = $site->getProvince();
//省
$cities = $site->getCity($pro_code);
//城市
//查詢數據
$college = new \College();
$result = $college->getList($page_id, $limit, $pro_code, $city_code, $col_type, $keyword);
//數據
$page_html = $this->pageHtml($result['page']);
//分頁html
//加載js
$this->assets->addJs('backend/mt-js/college-list.js');
$this->view->setVars(['pro_code' => $pro_code, 'city_code' => $city_code, 'col_type' => $col_type, 'keyword' => $keyword, 'provinces' => $provinces, 'cities' => $cities, 'list' => $result['list'], 'page_html' => $page_html]);
}
示例4: basicAction
/**
* 小初高基本信息
*/
public function basicAction($sch_id)
{
//判斷是否是ajax
if ($this->request->isAjax()) {
$validate = new \Validate();
$data['sch_logo'] = $validate->getPost('sch_logo');
//學校logo
$data['sch_thumb'] = $validate->getPost('sch_thumb');
//學校縮略圖
$data['sch_name'] = $validate->getPost('sch_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)()]{2,30}$/iu'));
//學校名稱
$data['sch_build'] = $validate->getPost('sch_build', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}\\(\\)\\-()]{2,30})?$/iu'));
//學校創建時間
$data['sch_way'] = $validate->getPost('sch_way', \Validate::length(60, 0), ['slashes' => true]);
//入學途徑
$data['sch_department'] = $validate->getPost('sch_department', \Validate::length(60, 0), ['slashes' => true]);
//隸屬部門
$data['is_join'] = $validate->getPost('is_join', \Validate::scopeCall('Setting', 'getJoin'));
//官方合作
$data['public_type'] = $validate->getPost('public_type', \Validate::scopeCall('Setting', 'getPublic'));
//辦學性質
$data['home_type'] = $validate->getPost('home_type', \Validate::scopeCall('Setting', 'getHome'));
//住宿情況
$data['exam_type'] = $validate->getPost('exam_type', \Validate::scopeCall('Setting', 'getExam'));
//入學考試
$data['stress_type'] = $validate->getPost('stress_type', \Validate::scopeCall('Setting', 'getSchStress'));
//重點情況
$data['sch_type'] = $validate->getPost('sch_type', \Validate::scopeCall('Setting', 'getSchType'));
//學校類型
$data['sch_tel'] = $validate->getPost('sch_tel', \Validate::length(60, 0), ['slashes' => true]);
//聯係電話
$data['pro_code'] = $validate->getPost('pro_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//學校所在省份編碼
$data['city_code'] = $validate->getPost('city_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//學校所在城市編碼
$data['area_code'] = $validate->getPost('area_code', \Validate::regex('/^[1-9]\\d{5}$/'));
//學校所在區縣編碼
$data['sch_addr'] = $validate->getPost('sch_address', \Validate::length(60, 0), ['slashes' => true, 'html' => true]);
//詳細地址
$data['sch_summary'] = $validate->getPost('sch_summary', \Validate::length(100000, 0), ['slashes' => true]);
//學校簡介
$data['sch_key'] = $validate->getPost('sch_key', \Validate::regex('/^([a-z0-9\\x{4e00}-\\x{9fa5}]{1,20}([\\s,][a-z0-9\\x{4e00}-\\x{9fa5}]{1,10}){0,9})?$/iu'));
//關鍵詞
$data['sch_desc'] = $validate->getPost('sch_desc', \Validate::length(250, 0), ['slashes' => true, 'html' => true]);
//描述
$data['sch_cost'] = $validate->getPost('sch_cost', \Validate::length(100000, 0), ['slashes' => true]);
//收費情況
$data['sch_lesson'] = $validate->getPost('sch_lesson', \Validate::length(200, 0), ['slashes' => true]);
//課程體係
$data['sch_fruit'] = $validate->getPost('sch_fruit', \Validate::length(100000, 0), ['slashes' => true]);
//辦學成果
$data['sch_power'] = $validate->getPost('sch_power', \Validate::length(100000, 0), ['slashes' => true]);
//驗證參數
if ($validate->getMessage()) {
$this->end(400);
}
//生成學校logo,縮略圖
$sch_logo = \Func::touchImg($data['sch_logo'], 'sch_logo');
$sch_thumb = \Func::touchImg($data['sch_thumb'], 'sch_thumb');
//將生成的圖片地址存入img,用戶失敗時刪除
$img = [UPLOAD_PATH . $sch_logo, UPLOAD_PATH . $sch_thumb];
//監測圖片是否全部生成成功
if ($data['sch_logo'] && !$sch_logo || $data['sch_thumb'] && !$sch_thumb) {
\FileUtil::getInstance()->unlink($img);
$this->end(400);
}
$data['sch_logo'] = $sch_logo;
$data['sch_thumb'] = $sch_thumb;
$this->end((new \School())->updSchoolBasic($this->session->get('id'), $sch_id, $data));
}
//學校id
$sch_id = (int) $sch_id;
//獲取基本數據
$basic = (new \School())->getSchoolBasic($sch_id);
//獲取區域數據
$site = new \Site();
$provinces = $site->getProvince();
//省份
$cities = $site->getCity($basic['pro_code']);
//城市
$areas = $site->getArea($basic['city_code']);
//區
//加載js
$this->assets->addJs('backend/js/editors/summernote/summernote.js');
$this->assets->addJs('backend/js/datetime/bootstrap-datepicker.js');
$this->assets->addJs('backend/mt-js/school-basic.js');
$this->view->setLayout('school');
$this->view->setVars(['sch_id' => $sch_id, 'basic' => $basic, 'provinces' => $provinces, 'cities' => $cities, 'areas' => $areas]);
}
示例5: listInfo
private function listInfo($pro_code, $city_code, $area_code, $public_type, $sch_type, $stress, $keyword, $sort, $page_id = 1)
{
//所有省份
$site = new \Site();
$provinces = $site->getProvince();
$provinces[0]['name'] = '不限';
foreach ($provinces as $key => $val) {
$provinces[$key]['url'] = "/school-{$val['code']}-0-0-{$public_type}-{$sch_type}-{$stress}-{$sort}?key=" . urlencode($keyword);
}
//當前省份名稱
if ($pro_code == 0) {
$pro_name = '不限';
} else {
$pro_name = $site->getProName($pro_code);
$pro_name = empty($pro_name) ? '未知' : $pro_name;
}
//對應城市
$cities = $site->getCity($pro_code);
$cities[0]['name'] = '不限';
foreach ($cities as $key => $val) {
$cities[$key]['url'] = "/school-{$pro_code}-{$val['code']}-0-{$public_type}-{$sch_type}-{$stress}-{$sort}?key=" . urlencode($keyword);
}
//當前城市名稱
if ($city_code == 0) {
$city_name = '不限';
} else {
$city_name = $site->getCityName($city_code);
$city_name = empty($city_name) ? '未知' : $city_name;
}
//對應區縣
$areas = $site->getArea($city_code);
$areas[0]['name'] = '不限';
foreach ($areas as $key => $val) {
$areas[$key]['url'] = "/school-{$pro_code}-{$city_code}-{$val['code']}-{$public_type}-{$sch_type}-{$stress}-{$sort}?key=" . urlencode($keyword);
}
//當前區縣名稱
if ($area_code == 0) {
$area_name = '不限';
} else {
$area_name = $site->getAreaName($area_code);
$area_name = empty($area_name) ? '未知' : $area_name;
}
//性質
$public = \Setting::getPublic();
unset($public['-1']);
array_unshift($public, '不限');
foreach ($public as $key => $val) {
$public[$key] = ['name' => $val, 'url' => "/school-{$pro_code}-{$city_code}-{$area_code}-{$key}-{$sch_type}-{$stress}-{$sort}?key=" . urlencode($keyword)];
}
//學校層次
$type = \Setting::getSchType();
unset($type[1]);
foreach ($type as $key => $val) {
$type[$key] = ['name' => $val, 'url' => "/school-{$pro_code}-{$city_code}-{$area_code}-{$public_type}-{$key}-{$stress}-{$sort}?key=" . urlencode($keyword)];
}
//重點
$stress_type = \Setting::getSchStress();
unset($stress_type[-1]);
array_unshift($stress_type, '不限');
foreach ($stress_type as $key => $val) {
$stress_type[$key] = ['name' => $val, 'url' => "/school-{$pro_code}-{$city_code}-{$area_code}-{$public_type}-{$sch_type}-{$key}-{$sort}?key=" . urlencode($keyword)];
}
//篩選關鍵字,最長80,並轉義
$keyword = addslashes(mb_substr($keyword, 0, 80, 'utf-8'));
//排序
$order = [1 => '熱度', 2 => '升學率', 3 => '好評'];
foreach ($order as $key => $val) {
$order[$key] = ['name' => $val, 'url' => "/school-{$pro_code}-{$city_code}-{$area_code}-{$public_type}-{$sch_type}-{$stress}-{$key}?key=" . urlencode($keyword)];
}
//獲取大學列表
$list = (new \School())->getSchoolList($pro_code, $city_code, $area_code, $public_type, $sch_type, $stress, $keyword, $sort, $page_id);
$page_html = $this->pageHtml($list['page']);
return ['list' => $list['list'], 'page' => $list['page'], 'page_html' => $page_html, 'provinces' => $provinces, 'pro_code' => $pro_code, 'pro_name' => $pro_name, 'cities' => $cities, 'city_code' => $city_code, 'city_name' => $city_name, 'areas' => $areas, 'area_code' => $area_code, 'area_name' => $area_name, 'public' => $public, 'public_type' => $public_type, 'type' => $type, 'sch_type' => $sch_type, 'stress_type' => $stress_type, 'stress' => $stress, 'keyword' => $keyword, 'order' => $order, 'sort' => $sort];
}