<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                人人商城小程序配置 ``` module.exports\={ ????appid:"wx05dd69862a06aa03",//修改小程序appid ????api:"https://test.test.cn/app/ewei\_shopv2\_api.php?i=1",//修改后臺域名和公眾號unaicd i 參數看微擎后臺哪個公眾號他的數字是幾就是幾 ????approot:"https://test.test.cn/addons/ewei\_shopv2/",//修改后臺域名 ????userInfo:null }; ``` ![](https://img.kancloud.cn/98/f6/98f6e2e0f9dadc864f30e5ae1e5aa108_1878x942.png) 小程序接口訪問地址 ``` http://wq.cn/app/ewei_shopv2_api.php?i=1&r= r參數 就是 app 下面文件夾 用.“.”來連接就行 ``` 人人商城php7環境 小程序加解密 ![](https://img.kancloud.cn/9d/8e/9d8ed6676ef7f6bbab0e607ce8fc761e_588x287.png) wxBizDataCrypt.php: ``` ~~~ <?php require_once EWEI_SHOPV2_PLUGIN . "app/core/wxapp/pkcs7Encoder.php"; /** * 對微信小程序用戶加密數據的解密示例代碼. * * @copyright Copyright (c) 1998-2014 Tencent Inc. */ class WXBizDataCrypt { private $appid = NULL; private $sessionKey = NULL; /** * 構造函數 * @param $sessionKey string 用戶在小程序登錄后獲取的會話密鑰 * @param $appid string 小程序的appid */ public function WXBizDataCrypt($appid, $sessionKey) { $this->sessionKey = $sessionKey; $this->appid = $appid; } /** * 檢驗數據的真實性,并且獲取解密后的明文.php7.0以下 * @param $encryptedData string 加密的用戶數據 * @param $iv string 與用戶數據一同返回的初始向量 * @param $data string 解密后的原文 * * @return int 成功0,失敗返回對應的錯誤碼 */ // public function decryptData($encryptedData, $iv, &$data) // { // if (strlen($this->sessionKey) != 24) { // return ErrorCode::$IllegalAesKey; // } // $aesKey = base64_decode($this->sessionKey); // if (strlen($iv) != 24) { // return ErrorCode::$IllegalIv; // } // $aesIV = base64_decode($iv); // $aesCipher = base64_decode($encryptedData); // $pc = new Prpcrypt($aesKey); // $result = $pc->decrypt($aesCipher, $aesIV); // if ($result[0] != 0) { // return $result[0]; // } // $dataObj = json_decode($result[1]); // if ($dataObj == NULL) { // return ErrorCode::$IllegalBuffer; // } // if ($dataObj->watermark->appid != $this->appid) { // return ErrorCode::$IllegalBuffer; // } // $data = $result[1]; // return ErrorCode::$OK; // } public function decryptData( $encryptedData, $iv, &$data ) { if (strlen($this->sessionKey) != 24) { return ErrorCode::$IllegalAesKey; } $aesKey=base64_decode($this->sessionKey); if (strlen($iv) != 24) { return ErrorCode::$IllegalIv; } $aesIV=base64_decode($iv); //$aesCipher=base64_decode($encryptedData); $aesCipher=$encryptedData; $pc = new Prpcrypt($aesKey); $result = $pc->decrypt($aesCipher,$aesIV); if ($result[0] != 0) { return $result[0]; } $dataObj=json_decode( $result[1] ); if( $dataObj == NULL ) { return ErrorCode::$IllegalBuffer.'--'; } if( $dataObj->watermark->appid != $this->appid ) { return ErrorCode::$IllegalBuffer.';;'; } $data = $result[1]; return ErrorCode::$OK; } } ?> ``` pkcs7Encoder.php ___ ``` <?php require_once EWEI_SHOPV2_PLUGIN . "app/core/wxapp/errorCode.php"; /** * PKCS7Encoder class * * 提供基于PKCS7算法的加解密接口. */ class PKCS7Encoder { public static $block_size = 16; /** * 對需要加密的明文進行填充補位 * @param $text 需要進行填充補位操作的明文 * @return 補齊明文字符串 */ public function encode($text) { $block_size = PKCS7Encoder::$block_size; $text_length = strlen($text); $amount_to_pad = PKCS7Encoder::$block_size - $text_length % PKCS7Encoder::$block_size; if ($amount_to_pad == 0) { $amount_to_pad = PKCS7Encoder::block_size; } $pad_chr = chr($amount_to_pad); $tmp = ""; for ($index = 0; $index < $amount_to_pad; $index++) { $tmp .= $pad_chr; } return $text . $tmp; } /** * 對解密后的明文進行補位刪除 * @param decrypted 解密后的明文 * @return 刪除填充補位后的明文 */ public function decode($text) { $pad = ord(substr($text, -1)); if ($pad < 1 || 32 < $pad) { $pad = 0; } return substr($text, 0, strlen($text) - $pad); } } /** * Prpcrypt class * * */ class Prpcrypt { public $key = NULL; public function Prpcrypt($k) { $this->key = $k; } /** * 對密文進行解密 php7.0以下 * @param string $aesCipher 需要解密的密文 * @param string $aesIV 解密的初始向量 * @return string 解密得到的明文 */ /* public function decrypt($aesCipher, $aesIV) { try { $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, "", MCRYPT_MODE_CBC, ""); exit('4545454'); mcrypt_generic_init($module, $this->key, $aesIV); $decrypted = mdecrypt_generic($module, $aesCipher); mcrypt_generic_deinit($module); mcrypt_module_close($module); } catch (Exception $e) { return array(ErrorCode::$IllegalBuffer, NULL); } try { $pkc_encoder = new PKCS7Encoder(); $result = $pkc_encoder->decode($decrypted); } catch (Exception $e) { return array(ErrorCode::$IllegalBuffer, NULL); } return array(0, $result); }*/ public function decrypt( $aesCipher, $aesIV ) { try { $decrypted = openssl_decrypt($aesCipher,'AES-128-CBC',$this->key,OPENSSL_ZERO_PADDING,$aesIV); // var_dump($decrypted); } catch (Exception $e) { return array(ErrorCode::$IllegalBuffer, null); } try { //去除補位字符 $pkc_encoder = new PKCS7Encoder; $result = $pkc_encoder->decode($decrypted); } catch (Exception $e) { //print $e; return array(ErrorCode::$IllegalBuffer, null); } return array(0, $result); } } ?> ``` 微擎直接跳轉到人人商城首頁 > $forward='xxxxx'; ![](https://img.kancloud.cn/16/8b/168b28fbc002a903ce1e1099f2c64bed_1487x549.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看