//声明CODE,获取小程序传过来的CODE $code = $_GET["code"]; //配置appid $appid = "请输入appid"; //配置appscret $secret = "请输入appscret"; //api接口 $api = "https://api.weixin.qq.com/sns/jscode2session?appid={$appid}&secret={$secret}&js_code={$code}&grant_type=authorization_code"; //获取GET请求 function httpGet($url){ $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 500); curl_setopt($curl, CURLOPT_S
public $data = null; /** * 退款 * @param int $orderid 商户订单号 * @param float $totalAmount 订单金额 * @return string */ public function doRefund($orderid, $totalAmount) { $mchid = '微信商户号'; $appid = 'APPID'; $apiKey = 'API密钥'; $orderNo = '商户订单号'; // 必填 $wxOrderNo = ''; //微信订单号 不填 $totalFee = $totalAmount; //订单金额,单位:元 $refundFee = $totalAmount; //退款金额,单位:元 $
使用ThinkPHP5写的微信支付,$res数组下是要使用到的数据 //微信支付 public function Pay() { $res = request()->param(); //注意::::117行需要填写商户密钥wx_key //总金额 $res['total_fee'] = intval($res['total_fee'] * 100); //appid $appid = $res['appid']; $body = '内容体'; $mch_id = '商户号'; //随机字符串 $nonce_str = $this->nonce_str(); $notify_url = '回调地址,一个url'; //用户openid $openid = $res['openid']; //商户订单号 $out_t
半年前开发的公众号突然获取不到access_token,于是查了以下才发现是写法的问题,以前的环境这么写没问题,修改成以下方式即可解决修改前:$code = $res['code']; $url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='. $this->appid .'&secret='. $this->secret .'&code='. $code .'&grant_type=authorization_code'; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); $tokens = js
1、初始化蓝牙模块openBluetoothAdapter:function() { let that = this; wx.openBluetoothAdapter({ complete(res) { } }) },2、检查蓝牙适配器状态getBluetoothAdapterState: function () { let that = this; wx.getBluetoothAdapterState({ success(res) { } }) },3、搜索蓝牙外围设备getBluetoothAdapterState: function () { let that = this; wx.getBluetoothAdapterState({ success(res) { } }) },4、获取所有已经发现的蓝牙设备 getBluetoothDevices:funct
最近在搞一个扫码的小程序,需要跟硬件对接,其中有一项选用AES128/CFB128/NOPACK加密,找半天才发现原来小程序本身有插件这东西1、登录小程序后台进到最下面的设置里选择第三方服务,然后再点击下方的添加插件2、搜索到Crypot然后添加3、引入Crypot加密1、在app.json文件里加入下面代码"plugins": { "crypto": { "version": "0.0.003", "provider": "wxf25d506ff81e19fb" } }2、在要使用加密的文件里引入const crypto = requirePlugin("crypto");3、加密解密var mi = new crypto.AES().encrypt('010203040506', key, { iv: iv, mode: crypto.Mode.CFB, padding:
SK
Devil in My Mind.