Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SwpuEsine opened this issue Oct 27, 2024 · 1 comment
Open

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

SwpuEsine opened this issue Oct 27, 2024 · 1 comment

Comments

@SwpuEsine
Copy link

我用的环境

  • 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验证失败

@overtrue
Copy link
Collaborator

因为你输出了多余的 header 头。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants