1 | <?php |
||
2 | |||
3 | // +---------------------------------------------------------------------- |
||
4 | // | ThinkLibrary 6.0 for ThinkPhP 6.0 |
||
5 | // +---------------------------------------------------------------------- |
||
6 | // | 版权所有 2017~2020 [ https://www.dtapp.net ] |
||
7 | // +---------------------------------------------------------------------- |
||
8 | // | 官方网站: https://gitee.com/liguangchun/ThinkLibrary |
||
9 | // +---------------------------------------------------------------------- |
||
10 | // | 开源协议 ( https://mit-license.org ) |
||
11 | // +---------------------------------------------------------------------- |
||
12 | // | gitee 仓库地址 :https://gitee.com/liguangchun/ThinkLibrary |
||
13 | // | github 仓库地址 :https://github.com/GC0202/ThinkLibrary |
||
14 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
||
15 | // +---------------------------------------------------------------------- |
||
16 | |||
17 | namespace DtApp\ThinkLibrary; |
||
18 | |||
19 | use think\admin\service\AdminService; |
||
0 ignored issues
–
show
|
|||
20 | use think\Request; |
||
21 | use think\Service; |
||
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
DtApp\ThinkLibrary\Service . Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
![]() |
|||
22 | |||
23 | /** |
||
24 | * 模块注册服务 |
||
25 | * Class Library |
||
26 | * @package DtApp\ThinkLibrary |
||
27 | */ |
||
28 | class Library extends Service |
||
29 | { |
||
30 | /** |
||
31 | * 定义当前版本 |
||
32 | */ |
||
33 | const VERSION = '6.0.131'; |
||
34 | |||
35 | /** |
||
36 | * 启动服务 |
||
37 | */ |
||
38 | public function boot() |
||
39 | { |
||
40 | |||
41 | } |
||
42 | |||
43 | /** |
||
44 | * 初始化服务 |
||
45 | */ |
||
46 | public function register() |
||
47 | { |
||
48 | // 输入默认过滤 |
||
49 | $this->app->request->filter(['trim']); |
||
50 | // 判断访问模式,兼容 CLI 访问控制器 |
||
51 | if (!$this->app->request->isCli()) { |
||
52 | // 注册访问处理中间键 |
||
53 | $this->app->middleware->add(function (Request $request) { |
||
54 | $header = []; |
||
55 | if (($origin = $request->header('origin', '*')) !== '*') { |
||
56 | $header['Access-Control-Allow-Origin'] = $origin; |
||
57 | $header['Access-Control-Allow-Methods'] = 'GET,PUT,POST,PATCH,DELETE'; |
||
58 | $header['Access-Control-Allow-Headers'] = 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With,User-Form-Token,User-Token,Token'; |
||
59 | $header['Access-Control-Expose-Headers'] = 'User-Form-Token,User-Token,Token'; |
||
60 | $header['Access-Control-Allow-Credentials'] = 'true'; |
||
61 | } |
||
62 | // 访问模式及访问权限检查 |
||
63 | if ($request->isOptions()) { |
||
64 | return response()->code(204)->header($header); |
||
65 | } |
||
66 | }, 'route'); |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths