Skip to content

4.x token验证失败,老代码调用的时候报错了 #2852

Closed
@SwpuEsine

Description

@SwpuEsine

我用的环境

  • 4.x:
  • overtrue/wechat 版本:
  • 是否使用了框架?框架名称:

问题及现象

`<?php

namespace app\api\controller;

use EasyWeChat\Factory;
use think\facade\Log;

class Wechat extends Controller
{
public function serve()
{
$app = Factory::officialAccount(config('wechat.official_account'));

    $app->server->push(function($message) {
        return "您好!欢迎使用我们的公众号!";
    });

   // return $app->server->serve();


    $response = $app->server->serve();

// 将响应输出
$response->send(); exit;
}

}`

代码如上。debug 发现已经发送了

X-Powered-By: PHP/7.4.33
Cache-Control: no-cache, private
Date: Sun, 27 Oct 2024 07:12:03 GMT
Content-type: text/html; charset=UTF-8

7551929723859630014

提示token验证失败

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions