yii framework用作api的时候一般都是用json对象打交道
下面总结集中方式:
1 第一种方式,在输出数据的时候,进行格式转换
头部:header(‘content-type:application/json;charset=utf8’);
json_encode
return json
2 第二种 利用yii的函数 利用 response响应 在输出之前 进行处理
beforeSend函数 response进行格式处理
3 利用自带的RESTful api输出样式
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_422.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57