微信小程序开发-消息推送配置篇
我一直在捣鼓,捣鼓了很久,才明白 小程序消息推送配置和微信公众号基本配置一模一样<?php
namespace App\Http\Controllers\Toling;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
// 引入EasyWeChat的主项目工厂类。
use EasyWeChat\Factory;
/**
* 对微信公众号 发来事件的 处理
*/
class ToLingController extends BaseController
{
public function index()
{
$config = [
'app_id' => 'wx4240ad1029d2c7f1',
'secret' => 'dd9eb0b42c4bde7528174e05d7fa1770',
// 下面为可选项
// 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => __DIR__.'/wechat.log',
],
];
$app = Factory::miniProgram($config);
}
public function c()
{
return 1;
}
// 配置小程序消息配置
public function checkSignature(){
$config = [
'app_id' => 'wx4240ad1029d2c7f1',
'secret' => 'dd9eb0b42c4bde7528174e05d7fa1770',
'token' => '这里隐藏',
'response_type' => 'array',
'aes_key'=> 'i9ty8q7F5tqIpp34U48EfgX4cLK1ZJ9pn4RmIIEbqIW'
];
$app = Factory::officialAccount($config);
$response = $app->server->serve();
// 将响应输出
return $response;
}
}
页:
[1]