From 6b5e2e944dc99a56732ac323f65a297e34aaf1e1 Mon Sep 17 00:00:00 2001 From: yuenblue <1192129692@qq.com> Date: Thu, 28 Mar 2024 11:50:02 +0800 Subject: [PATCH] aaa --- demotp6/app/AppService.php | 6 +++++- demotp6/app/controller/Index.php | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/demotp6/app/AppService.php b/demotp6/app/AppService.php index fbd10da..b87f4b9 100644 --- a/demotp6/app/AppService.php +++ b/demotp6/app/AppService.php @@ -4,7 +4,7 @@ declare (strict_types = 1); namespace app; use think\Service; - +use think\facade\Event; /** * 应用服务类 */ @@ -14,6 +14,10 @@ class AppService extends Service { // 服务注册 // $this->app->bind() + Event::listen('UserLogin', function($user) { + print "????"; + }); + } public function boot() diff --git a/demotp6/app/controller/Index.php b/demotp6/app/controller/Index.php index 7e413d7..32d0c64 100644 --- a/demotp6/app/controller/Index.php +++ b/demotp6/app/controller/Index.php @@ -2,6 +2,7 @@ namespace app\controller; use app\BaseController; +use think\facade\Event; use think\facade\Route; class Index extends BaseController @@ -13,6 +14,7 @@ class Index extends BaseController public function hello($name = 'ThinkPHP6') { + Event::trigger("UserLogin","aaaa"); var_dump($this->request); return Route::buildUrl('aaaa',['name'=>$name])->__toString(); } -- GitLab