ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
参考文章 https://www.cnblogs.com/meng1314-shuai/p/7232080.html #### 1. bootstrap/app.php ```php $app->register(App\Providers\EventServiceProvider::class); ``` #### 2. app/Providers/EventServiceProvier.php ```php <?php namespace App\Providers; use Illuminate\Database\Events\StatementPrepared; use Laravel\Lumen\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { /** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'App\Events\SomeEvent' => [ 'App\Listeners\EventListener', ], ]; public function boot() { app('events')->listen(StatementPrepared::class, function ($event) { $event->statement->setFetchMode(\PDO::FETCH_ASSOC); }); } } ```