基於Thinkphp5.0 小程序登陸插件應用

資源鏈接:linux

wulongtao/think-wxminihelper

 

具體怎麼安裝,不介紹了,有不懂再問我吧; 主要重點以下:git

wepy:index.wpygithub

  1. this.$parent.getUserInfo(function(userinfo){})wepy下的這個方法只能獲取基本數據;須要使用:wepy.getUserInfo()
  2. $session3rd = $this->randomFromDev(16) 插件內 應用這個方法時,須要linux環境不然就會報錯;


    解決方法(因此PHP要產生真隨機數 仍是要調用外部元素來支持的!):$fp = @fopen('/dev/urandom','rb') 爲了生成真隨機數,最好使用這個方法。
    若是本地開發的話,能夠使用假隨機數。暫時使用。到時再替換回去。代碼以下:
    /**
     *生成隨機數,可用戶驗證碼
     *@param
     */
    function randStr($m = 5) {
        $new_str = '';
        $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwsyz0123456789';
        $max=strlen($str)-1;
        for ($i = 1; $i <= $m; ++$i) {
            $new_str .=$str[mt_rand(0, $max)];
        }
        return $new_str;
    }

     

相關文章
相關標籤/搜索