Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tencent
services
Commits
7c03d6ea
Commit
7c03d6ea
authored
Jul 16, 2018
by
zhufx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.自建组件,支持配置扫描目录
parent
c28249a3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
src/Common/Config/Bean/PathConfig.php
+22
-0
src/Common/Config/Bean/ScanPath.php
+11
-12
No files found.
src/Common/Config/Bean/PathConfig.php
0 → 100644
View file @
7c03d6ea
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/7/16
* Time: 11:09
*/
$basePath
=
dirname
(
__DIR__
,
3
);
/**
* 用于自建组件扫描路径配置(键值是方便开发人员理解,代码中无意义)
* [
* 'commonPath' => $basePath.'/Common',
* 'enmu' => $basePath.'/Order/Enum',
*
* ];
*/
return
[
'commonPath'
=>
$basePath
.
'/Common'
,
];
\ No newline at end of file
src/Common/Config/Bean/ScanPath.php
View file @
7c03d6ea
...
@@ -5,19 +5,19 @@
...
@@ -5,19 +5,19 @@
* Date: 2018/7/16
* Date: 2018/7/16
* Time: 9:32
* Time: 9:32
*/
*/
$
basePath
=
dirname
(
__DIR__
,
3
)
;
$
scanPaths
=
include
__DIR__
.
'/PathConfig.php'
;
$data
=
[];
$files
=
\Swoft\Helper\DirHelper
::
glob
(
$basePath
,
'*.php'
);
foreach
(
$scanPaths
as
$basePath
)
{
$files
=
\Swoft\Helper\DirHelper
::
glob
(
$basePath
,
'*.php'
);
$baseNamespace
=
"Hdll\Services
\\
"
;
$baseNamespace
=
"Hdll\Services"
;
foreach
(
$files
as
$file
)
{
$data
=
[];
$pathSpace
=
str_replace
(
"/var/www/swoft/vendor/hdll/services/src/"
,
""
,
$file
);
foreach
(
$files
as
$file
)
{
$pathSpace
=
dirname
(
$pathSpace
);
$path
=
dirname
(
$file
);
$pathSpace
=
str_replace
(
"/"
,
"
\\
"
,
$pathSpace
);
$suffixNamespace
=
str_replace
(
$basePath
,
""
,
$path
);
$suffixNamespace
=
str_replace
(
"/"
,
"
\\
"
,
$suffixNamespace
);
$namespace
=
$baseNamespace
.
$suffixNames
pace
;
$namespace
=
$baseNamespace
.
$pathS
pace
;
$fileName
=
basename
(
$file
,
'.php'
);
$fileName
=
basename
(
$file
,
'.php'
);
...
@@ -43,8 +43,7 @@ foreach ( $files as $file ) {
...
@@ -43,8 +43,7 @@ foreach ( $files as $file ) {
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment