Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 事件不';t work laravel,在队列中,进程正在进行中,并给出一个错误_Php_Laravel - Fatal编程技术网

Php 事件不';t work laravel,在队列中,进程正在进行中,并给出一个错误

Php 事件不';t work laravel,在队列中,进程正在进行中,并给出一个错误,php,laravel,Php,Laravel,创建了一个事件,它在本地工作,并将其上载到服务器停止工作 [2021-04-02 14:26:51]local.ERROR:找不到类“Redis”{“exception”:“[object](错误(代码:0):在/vendor/laravel/framework/src/light/Redis/Connectors/PhpRedisConnector.php:75中找不到类“Redis”) [stacktrace] 如何连接Redis PrivatMessageEvent.php <?ph

创建了一个事件,它在本地工作,并将其上载到服务器停止工作

[2021-04-02 14:26:51]local.ERROR:找不到类“Redis”{“exception”:“[object](错误(代码:0):在/vendor/laravel/framework/src/light/Redis/Connectors/PhpRedisConnector.php:75中找不到类“Redis”) [stacktrace]

如何连接Redis

PrivatMessageEvent.php

<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class PrivatMessageEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $data;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('private-channel');
    }
}
配置\bd

   'redis' => [
        'client' => env('REDIS_CLIENT', 'phpredis'),
        'cluster' => false,
        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'database' => 0,
            'port' => env('REDIS_PORT', '6379'),
        ]
    ]

您能否验证是否已安装并启用phpredis扩展


请查看Laravel文档中的介绍部分:

my config bd.“redis”=>env('redis_client','phpredis'),'cluster'=>false,'default'=>env('redis_host','127.0.0.1'),'database'=>0','port=>env('redis_port','6379'),]谢谢,但是您需要一些额外的依赖项才能实际使用Redis实现。请尝试运行
pecl install Redis
composer require predis/predis
@Маааааааа检查您在
.env
中设置了什么。在.env Redisаu客户端中没有什么,应该有什么?编写器需要predis/predis完成。我检查萝卜的状态,它处于活动状态
   'redis' => [
        'client' => env('REDIS_CLIENT', 'phpredis'),
        'cluster' => false,
        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'database' => 0,
            'port' => env('REDIS_PORT', '6379'),
        ]
    ]