這篇文章將為大家詳細(xì)講解有關(guān)微信小程序?qū)崿F(xiàn)request請(qǐng)求后臺(tái)接口php的示例分析,小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
創(chuàng)新互聯(lián)是一家專(zhuān)業(yè)提供平定企業(yè)網(wǎng)站建設(shè),專(zhuān)注與成都網(wǎng)站制作、做網(wǎng)站、H5建站、小程序制作等業(yè)務(wù)。10年已為平定眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專(zhuān)業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。
微信小程序request請(qǐng)求后臺(tái)接口php的實(shí)例詳解
后臺(tái)php接口:http://www.vueyun.com/good/info
沒(méi)有處理數(shù)據(jù),直接返回了,具體再根據(jù)返回格式處理
public function getGoodInfo(Request $request) { $goods_datas = $this->Resource->get(); return response()->json(['status' => 'success','code' => 200,'message' => '獲取成功','data'=>$goods_datas]); }
小程序index.js文件中 onLoad
onLoad: function () { console.log('onLoad') wx.request({ //上線(xiàn)接口地址要是https測(cè)試可以使用http接口方式 url: 'http://www.vueyun.com/good/info', data: {}, method: 'GET', header: { 'content-type': 'application/json' }, success: function (res) { that.setData({ goodslist: res.data.data }); console.log(res.data.data, 1111111); }, }) },
wxml文件,
<view class="goods-container"> <block wx:for="{{goodslist}}" wx:for-item="item" wx:for-index="idx" > <view class="goods-box" bindtap="goodsTap" data-id="{{item.id}}"> <view class="img-box"> <image src="{{item.img_url}}" class="image"/> </view> <view class="goods-title">{{item.img_title}}</view> <view class="goods-price">¥ {{item.good_price}}</view> </view> </block> </view>
關(guān)于“微信小程序?qū)崿F(xiàn)request請(qǐng)求后臺(tái)接口php的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
文章標(biāo)題:微信小程序?qū)崿F(xiàn)request請(qǐng)求后臺(tái)接口php的示例分析
分享路徑:http://muchs.cn/article20/jpgeco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、移動(dòng)網(wǎng)站建設(shè)、外貿(mào)建站、微信公眾號(hào)、網(wǎng)站內(nèi)鏈、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)