yupoxiong / Region
Licence: apache-2.0
ThinkPHP5/6省市区(县)街道四级联动扩展
Stars: ✭ 83
Labels
Projects that are alternatives of or similar to Region
MessageBoard
🍻thinkphp5 learning:a messageboard project
Stars: ✭ 18 (-78.31%)
Mutual labels: thinkphp5
say-love-wall
💖 由ThinkPHP5框架开发即开箱可用的告白墙、校园表白墙。表白可以通过发送邮箱告知对方,也可以分享表白内容。更多趣味查看 README.md 或网站。
Stars: ✭ 32 (-61.45%)
Mutual labels: thinkphp5
Uniadmin
UniAdmin是一套渐进式模块化开源后台,采用前后端分离技术,数据交互采用json格式,功能低耦合高内聚;核心模块支持系统设置、权限管理、用户管理、菜单管理、API管理等功能,后期上线模块商城将打造类似composer、npm的开放式插件市场;同时我们将打造一套兼容性的API标准,从ThinkPHP5.1+Vue2开始,逐步吸引爱好者共同加入,以覆盖larval、spring-boot、django、yii、koa、react等多语言框架。
Stars: ✭ 277 (+233.73%)
Mutual labels: thinkphp5
Lyadmin
lyadmin是一套轻量级通用后台,采用ThinkPHP+Bootstrap3制作,内置系统设置、上传管理、权限管理、模块管理、插件管理等功能,独有的Builder页面自动生成技术节省50%开发成本,先进的模块化开发的支持让开发成本一降再降,致力于为个人和中小型企业打造全方位的PHP企业级开发解决方案。另外提供整套企业开发解决方案,集PC、手机、微信、App、小程序五端于一体,更有用户中心模块、门户模块、钱包支付中心模块、商城模块、OAuth2统一登陆、内部Git模块、Docker模块可供选择。
Stars: ✭ 1,066 (+1184.34%)
Mutual labels: thinkphp5
Vue Admin Html
Vue-cli3.0 + Element UI + Spring Boot2.0 + ThinkPHP5.1 + 响应式的后台管理系统 https://lmxdawn.github.io/vue-admin
Stars: ✭ 436 (+425.3%)
Mutual labels: thinkphp5
ExpressPHP-V1
✨ ExpressPHP V1是一个极简的 web 开发MVC框架,和ThinkPHP5一样现代化,比CodeIgniter还要轻量级,真正突破框架限制,让你感受到自由,同时兼顾高性能、低学习成本。
Stars: ✭ 13 (-84.34%)
Mutual labels: thinkphp5
Thinkphp5 Restfulapi
restful-api风格接口 APP接口 APP接口权限 oauth2.0 接口版本管理 接口鉴权
Stars: ✭ 949 (+1043.37%)
Mutual labels: thinkphp5
cpms-php
使用thinkPHP5.0开发的后台简洁管理系统脚手架,cpms-php是采用TP5.0开发的一个简单的后台脚手架管理系统(包括前台展示和后台管理部分)。主要模块有:用户登入验证、后台管理员增删改查、文章发布、RBAC权限管理、socketIO在线即时聊天
Stars: ✭ 20 (-75.9%)
Mutual labels: thinkphp5
Lsky Pro
☁️Lsky Pro - Your photo album on the cloud.
Stars: ✭ 1,174 (+1314.46%)
Mutual labels: thinkphp5
Php Educational Administration
大学微信查教务成绩 数据抓取 数据分析 微信查成绩 验证码识别 redis缓存
Stars: ✭ 38 (-54.22%)
Mutual labels: thinkphp5
ThinkPHP省市区(县)街道四级联动扩展
支持
TP5.0.*
和TP5.1.*
还有TP6.0
,搜索功能支持汉字,支持拼音,首字母搜索。
安装
第一步:安装扩展
Composer 运行扩展安装命令
composer require yupoxiong/region
第二步:创建数据表
复制vendor/yupoxiong/region/database/migrations
目录下的数据库迁移文件到TP迁移目录(一般是 /database/migrations/
),然后运行TP自带迁移命令创建表。
TP5.1 版本可以直接运行以下两个命令完成安装
php think region:publish
php think region:migrate
TP6.0 版本可以直接运行以下命令完成安装
php think region:migrate
添加路由
TP5.0 在 /application/route.php
中追加,TP5.1 在 /route/route.php
中追加。
Route::alias('region','\yupoxiong\region\RegionController');
TP6.0版本已经去掉别名路由,可以在路由配置里添加以下路由(多应用模式在应用路由里添加):
Route::group('region',function (){
Route::any('getRegion','\yupoxiong\region\[email protected]');
Route::any('getProvince','\yupoxiong\region\[email protected]');
Route::any('getCity','\yupoxiong\region\[email protected]');
Route::any('getDistrict','\yupoxiong\region\[email protected]');
Route::any('getStreet','\yupoxiong\region\[email protected]');
Route::any('searchRegion','\yupoxiong\region\[email protected]');
Route::any('searchProvince','\yupoxiong\region\[email protected]');
Route::any('searchCity','\yupoxiong\region\[email protected]');
Route::any('searchDistrict','\yupoxiong\region\[email protected]');
Route::any('searchStreet','\yupoxiong\region\[email protected]');
});
使用
获取地区(最常用的方式)
- url
/region/getRegion
- 参数 parent_id ,可不传(默认0)获取省份,传入上级 id 即可获取该 id 对应的下级
获取省
- url
/region/getProvince
- 参数 无
获取市
- url
/region/getCity
- 参数 parent_id ,传入所属省 id 即可获取该省下面的市
获取区
- url
/region/getDistrict
- 参数 parent_id ,传入所属市 id 即可获取该市下面的区(县)
获取街道
- url
/region/getStreet
- 参数 parent_id ,传入所属区(县) id 即可获取该市下面的街道
搜索地区
- url
/region/searchRegion
- 参数 keywords ,搜索地区的关键字
- 参数 parent_id ,搜索地区的父级 id ,默认0为搜索省份
搜索省
- url
/region/searchProvince
- 参数 keywords ,搜索地区的关键字
搜索市
- url
/region/searchCity
- 参数 keywords ,搜索地区的关键字
- 参数 parent_id ,所属省 id
搜索区
- url
/region/searchDistrict
- 参数 keywords ,搜索地区的关键字
- 参数 parent_id ,所属市 id
搜索街道
- url
/region/searchStreet
- 参数 keywords ,搜索街道的关键字
- 参数 parent_id ,所属区(县) id
可选配置
可在配置文件中添加以下配置,5.0.* 在 /application/config.php
中追加。
//获取省市区街道缓存、查询字段配置
'region' => [
//查询缓存秒数,false为不缓存
'cache' => 20140210,
//查询字段,可选项:id,name,parent_id,initial,pinyin,citycode,adcode,lng_lat
'field' => 'id,name',
//排序,默认为adcode正序
'order' => 'adcode asc',
]
5.1.* 和 6.0 直接运行以下命令即可在 config 目录下生成
region.php
配置文件。
php think region:publish
Facade
TP5.1 和 TP6.0 可以在开发中直接使用以下代码获取数据:
\yupoxiong\region\facade\Region::getProvince();
//更多可参考该类
测试相关
安装配置好之后可以将vendor/yupoxiong/region/tests/region.html
放到项目public
目录下访问测试扩展是否可用
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].