国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

官方自帶的Http.php語法報(bào)錯

IT男

官方自帶的Http.php語法報(bào)錯

php版本7.4.3和8.2都會報(bào)錯
使用的是Push插件,調(diào)用如下代碼中的send方法時(shí)給出的報(bào)錯。

程序代碼

<?php
namespace app\controller;
use Webman\Push\Api;
use support\Request;

class Push{
    private $pusher;

    public function __construct(){
        $this->pusher = new Api(
            'http://127.0.0.1:3232',
            config('plugin.webman.push.app.app_key'),
            config('plugin.webman.push.app.app_secret')
        );
    }

    // 服務(wù)端推送消息
    public function send(){
        $this->pusher->trigger('notice', 'message', [
            'id'=>1,
            'title'=>'公告標(biāo)題',
            'summary'=>'公告摘要'
        ]);

        $this->pusher->trigger('private-user-1', 'message', '私有消息');
    }
}

報(bào)錯信息

Error: Object of class Webman\Push\Api could not be converted to string in /www/wwwroot/xxx/vendor/workerman/workerman/Protocols/Http.php:247
Stack trace:

截圖報(bào)錯信息里報(bào)錯文件相關(guān)代碼

截圖

操作系統(tǒng)及workerman/webman等框架組件具體版本

操作系統(tǒng) Linux
Workerman version:4.1.15
PHP version:7.4.3

609 1 0
1個回答

walkor 打賞

報(bào)錯很明顯,你控制器里返回了 Webman\Push\Api 實(shí)例。應(yīng)該返回字符串或者 Response對象才對。

  • IT男 2024-09-10

    一語點(diǎn)醒,修改了就可以了 謝謝大佬

??