1. Go to this page and download the library: Download urumuqi/wxxcx library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
urumuqi / wxxcx example snippets
Urumuqi\Wxxcx\WxxcxServiceProvider::class,
...
use Urumuqi\Wxxcx\Wxxcx;
class WxxcxController extends Controller
{
protected $wxxcx;
function __construct(Wxxcx $wxxcx)
{
$this->wxxcx = $wxxcx;
}
/**
* wx.getUserInfo 解析加密数据.
*/
public function getWxUserInfo()
{
// 微信登陆,获取到的session_key
$sessionKey = request('session_key', '');
//encryptedData 和 iv 在小程序端使用 wx.getUserInfo 获取
$encryptedData = request('encrypted_data', '');
$iv = request('iv', '');
return $this->wxxcx->getUserInfo($encryptedData, $iv, $sessionKey);
}
}
bash
php artisan vendor:publish --tag=wxxcx
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.