首页 > Windows开发 > 详细

api接口简短实力

时间:2017-11-25 10:18:06      阅读:479      评论:0      收藏:0      [点我收藏+]

无参数传递

public function actionJiekou(){
$url = ‘http://wap.guoshihui.com/_static/wap/video/startVideo.mp4‘;
$data = array(
‘status‘ => ‘200‘,
‘message‘ => ‘数据获取成功‘,
‘url‘ => $url,
);
return json_encode($data);
}

 

http://yii.com/frontend/web/index.php?r=country/jiekou

{"status":"200","message":"\u6570\u636e\u83b7\u53d6\u6210\u529f","url":"http:\/\/wap.guoshihui.com\/_static\/wap\/video\/startVideo.mp4"}

 有参数传递

public function actionJiekou(){
$id = $_GET[‘id‘];
$url = ‘http://wap.guoshihui.com/_static/wap/video/startVideo.mp4‘;
$data = array(
‘id‘ => $id,
‘status‘ => ‘200‘,
‘message‘ => ‘数据获取成功‘,
‘url‘ => $url,
);
return json_encode($data);
}

http://yii.com/frontend/web/index.php?r=country/jiekou&id=88897

{"id":"88897","status":"200","message":"\u6570\u636e\u83b7\u53d6\u6210\u529f","url":"http:\/\/wap.guoshihui.com\/_static\/wap\/video\/startVideo.mp4"}

 

api接口简短实力

原文:http://www.cnblogs.com/yszr/p/7893001.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!