api接口简短实力
无参数传递
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"}