? ?? ?? WeChat ???? ??? ???? ?? ??? ?????. ???? ? ??? ???? ?? ???? ????? ???????. ???? ?? ??????
Scenes
?? ????? 52???? ???? ???, ? ? 13???? ID? ???? ???, ??? 39???? ??? ??? ?????. ? 39? ????? WeChat ????? ??? ??? ??? ??? ???? ?????.
??? ??? ?? ??? ?? ??? ?? ??? ??? ??.
???? ?? ? ??
???? ??? ??? ???? ??? ?? ?? ???? ???? ?? ???? ????? ?????. ??? ???? ?? ???? ?????.
PHP? laravel ?????? ???? ???? ?? laravel ?????? http ????? ???? ???.
HTTP ????? ??????? ???? HTTP ??? ????? ??? ????? ?????. ?? ?? Laravel?? ????? ??? ??? ???? ????? ?????. ???? ???? ?? ?? ????? ???? ??? ???? ?????, ???? ??? ?? ????? ??? ?? ????? ?????. ?? ?? ??? ????? ???? ??? ??? ??? ?? ????. CORS ????? ????? ???? ?? ??? ??? ?? ??? ???? ??? ???. ??.
???? ?? WeChat ???? ??? ????? ?? ???? ????? ???? ???? ????. ??? Page ????? ?? ????? ??? ? ????.
onLoad? ?? ???? ? ?? ???? onShow? ?? ???? ?? ??? ? ? ?????(?: ???? ???? ???? ???).
onLoad ?? onShow ?? ???? ???? ??? ????, ???? ???? ??? ???? ????, ??? ??? ??? ???? ?????.
//orderDetail.js onShow: function () { let that = this; //身份校驗 service.identityCheck(() => { //跳轉(zhuǎn)到登錄頁 wx.redirectTo({ url: "/pages/common/login/login" }); }, () => { //獲取頁面數(shù)據(jù)等等 that.getDetail(this.orderId); ... } ); },
?, ?? ???? ??? ???? ??, ???? ??? ?? ????? ???. ?? ???? ????? ?? ? ????(? ? ??? ?? ?????):
//filter.js function identityFilter(pageObj){ if(pageObj.onShow){ let _onShow = pageObj.onShow; pageObj.onShow = function(){ service.identityCheck(()=>{ //跳轉(zhuǎn)到登錄頁 wx.redirectTo({ url: "/pages/common/login/login" }); },()=>{ //獲取頁面實例,防止this劫持 let currentInstance = getPageInstance(); _onShow.call(currentInstance); }); } } return pageObj; } function getPageInstance(){ var pages = getCurrentPages(); return pages[pages.length - 1]; } exports.identityFilter = identityFilter;
filter.js
用以提供過濾器方法,除了現(xiàn)有的用戶身份攔截,后續(xù)如果需要其他攔截,可以在這個文件增加。然后,在需要用戶身份攔截的小程序頁面代碼里,用filter.identityFilter
?? ?????:
//orderDetail.js let filter = require('filter.js'); Page(filter.identityFilter({ ... onShow: function () { //獲取頁面數(shù)據(jù)等等 this.getDetail(this.orderId); //... }, ... }));
???? ?? Promise ??
? ????? ???? ????, ???? ??? ???? ???(?, ? ??? service.identityCheck)? ?? ?????. ?? ? ???? ??? ?????? ??? ??? ????? ???. ?, app.js? onLaunch ????? ?????.
? ?? ???? ???? ??????? ????? ???? ??? ???? ?? ?? ??? ??? ?????. ??? ??? ID? ?? ?? ??? ?? ?? ???? ??? ???? ????? ??? ????.
Promise? ??? ??? ?? ??? ???? ? ?? ??? ?? ??? ??? ????. ???, ??? ??? ???????:
//app.js App({ onLaunch:function(){ let p = new Promise(function(resolve,reject){ service.identityCheck(resolve,reject); }); this.globalData.promise = p; }, ... globalData: { promise:null, } });
//filter.js const appData = getApp().globalData; function identityFilter(pageObj){ if(pageObj.onShow){ let _onShow = pageObj.onShow; pageObj.onShow = function(){ //改動點 appData.promise.then(()=>{ //跳轉(zhuǎn)到登錄頁 wx.redirectTo({ url: "/pages/common/login/login" }); },()=>{ //獲取頁面實例,防止this劫持 let currentInstance = getPageInstance(); _onShow.call(currentInstance); }); } } return pageObj; }
Summary
????? ?? ???? ???? ?? ??? ID ????? ????? ??? laravel? http ?????? ?????:
? ???? ??? ?? ? ??? ???? ????.
??? ?? ??? ?????? ?? ????? ??? ???? ???? ????. ??? ID? ?? ?? ??? ??? ???? ? 1?? ??? ?? ?? ???? ???? ?? ???? 1? ?? ??? ???? ?????. ??? ?? ???? ???. ?? ?? ? ?? ???? ? ???? ?????.
? ??? WeChat ??? ??? ?? ??? ????? ?? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Windows ?? ??? ???? ?? ?? ?? ?? ?? ? ????, ??? ??? Win11? ?? ??? ?????. Win11 ????? ??? ??? ?? ?? ???? ????? ? ?? ??? ??? ??? ? ??? ?? ??? ?????. ?? ???? Win11 ????? ??? ??? ?? ??? ??? ????? ???? ??? ??? ???????. Win11 ????? ??? ??? ?? ???? ??? ???? ? ?? ???? ????. ?? ???? ?? ???? ?? ?? ?? ??? ????.

C++? ?? ??? ?? ??? ?? ???? ??? ??? ???? ?? ?? ???? ?? ?????. C++ ????? ?? ??? ???? ?? ??? ???? ??? ?? ? ????. ?? ??? ??? ???? ??? ? ???, ????? ???? ? ?? ??? ???? ??? ?????. ? ?? ??? ?? ???? ???? ? ??? ?? ??? ???? ????. ??, ? ??? ??, ?? ??? ??? ???? ?? ???? ???? ???. ?? ?? ??? ??? ??? ?? ??? ?????.

OracleSQL? ??? ??? ?? ??? ?? OracleSQL?? ??? ??? ? ??? ?? ??? ???? ? ???? ????? ??? ?? ?????. ???? ?????? ??? ?? ????? OracleSQL?? ??? ??? ???? ???? ?? ?????? ????? ???? ?? ? ?????. ? ????? OracleSQL? ??? ?? ?? ??? ??? ???? ??? ??? ? ?? ?? ?? ??? ?????. 1. OracleSQL? Division ??

WeChat ?? ?????? ?? ??? ?? ?? WeChat ?? ?????? ?? ??? ??? ???? ?? ??? ??? ????? ?? ??? ??? ???? ? ?? ???? ????? ?????. ??? WeChat ????? ?? ??? ??? ???? ??? ??? ???? ?? ?? ??? ?????. ??, ?? ????? ??? ???? ??? ? ?? ?? ??? ???? ???. ??? ?? ??? ???? ?? ??? ?? ??? ?? ??? ???? ?? ????. <--index.wxml- ->&l

C++? ??? ??? ?? ??? ?? C++??? ??? ???(%)? ???? ? ??? ?? ???? ?????. ????? ?? ?? ??(char, short, int, long ? ??) ?? ?? ??? ?? ??(?: float, double)? ? ?? ?? ??????. ??? ???? ???? ??? ??? ?? ??? ?????. ?? ?? ??? ??? ??? ?? ?? ??? ???? ??? ? ????. inta=10;intb=3;

Numpy? ??? ?? ?? ??? ??? ???? Python ?? ??? ????????. Numpy ??? ?????? ? ???? ???? ?? ?? ??? ???? ???. ? ???? Numpy ?? ?? ??? ??? ???? ???? ?? ??? ?????. ?? 1: Python ??? ???? Numpy ?? ?? ??? ?? ?? ? ?? ?????. importnumpyasnpprint(np)

PHP? ??? ???(%)? ? ??? ?? ???? ??? ? ?????. ? ???? ??? ???? ??? ???? ??? ???? ??? ??? ?? ?? ???? ?? ??? ?????. 1. ??? ???? ?? ????? ??? ?? ??? ??? ?? ???? ????. ?? ?? 10? 3?? ??? ?? 3?? ???? 1???. ? ???? ?? ?? ??? ???? ?????. 2. ???? ???? ??? PHP??? ????? ???? ?? % ??? ?????.

Linux ??? ?? system() ??? ?? ??? ?? ??? ??? Linux ?? ???? ?? ??? ???? ??? ??? ?? ???? ??? ?????. ? ? system() ??? ?? ???? ??? ?? ?? ? ????. ? ????? system() ??? ???? ??? ???? ?? ?? ??? ?????. ??? ??? ?? ?? ??? ??? ??? ????? ?? ?? ??? ?? ???? ?????. ??? ????? ??? ?? ??? ???? ?? ??? ?????.
