From 3825a4bf392195378c23f557b078afa5fcb1e4af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3=E9=A5=AD?= <100103431@qq.com> Date: Mon, 9 Oct 2023 05:00:03 +0000 Subject: [PATCH] update docs/further/backend/annotation.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 米饭 <100103431@qq.com> --- docs/further/backend/annotation.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/further/backend/annotation.md b/docs/further/backend/annotation.md index 43ada06..57ca1d9 100644 --- a/docs/further/backend/annotation.md +++ b/docs/further/backend/annotation.md @@ -15,6 +15,9 @@ ### 注解如何书写 由于,我们已经使用了 `PHP 8.0` 及以上版本,我们可以使用php自带的原生注解,故我们也只讲原生注解使用方法。 +### 注解配置 +/config/autoload/annotations.php 可配置注解收集目录、收集器及忽略项 + 我们还是看控制器的代码,我们发现代码里存在两句: - #[Controller(prefix: "foo")] - #[GetMapping("index")] @@ -507,7 +510,7 @@ class UserDto implements MineModelExcel #### 注解名 - **#[DependProxy]** #### 说明 -无需修改源代码,可无感平替某个类或接口。 +无需修改源代码,可无感平替某个类或接口。在注解收集目录内,申明即生效。 #### 使用范围 - √ 代表可用 @@ -532,7 +535,7 @@ use Mine\Interfaces\UserServiceInterface; /** * 实现无感替换 mineadmin 自带的登录 退出 功能 */ -#[DependProxy([ values: UserServiceInterface::class )] +#[DependProxy(values: [ UserServiceInterface::class )] class loginHandler implements UserServiceInterface { public function login(\Mine\Vo\UserServiceVo $vo) -- Gitee