摘要:<?php include 'function.php'; $id = $_POST['id']; if(empty($id)){ return return_json(1,'请输入你需要查找的编号'); } $list = select('php_area',
<?php include 'function.php'; $id = $_POST['id']; if(empty($id)){ return return_json(1,'请输入你需要查找的编号'); } $list = select('php_area','*',"area_id=$id or area_pid=$id",'area_id desc'); if($list){ return return_json(0,$list); }else{ return return_json(2,'查询失败'); }
标题:查询省市区
地址:test01.com/area.php
传值:
Id 省、市的ID值
返回值:
{
"code": 0, //状态码
"msg": "success", //状态信息
"data": [ //返回的数据
{
"area_id": "1446", //省、市ID
"area_pid": "1437", //归属ID
"area_name": "长沙市", //省、市名
"sort": "0", //分类id
"status": "1", //该数据的开关
"type": "3" //省市所属等级
}
}
Code返回错误码:
0成功返回
1所需查询的id不能我空
2查询失败
批改老师:韦小宝批改时间:2019-01-15 15:49:31
老师总结:写的很不错 基本上接口返回的json数据都是这个格式的