This commit is contained in:
2021-03-03 19:05:57 +08:00
parent 3a496926c9
commit 04f844be51
2 changed files with 490 additions and 461 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ class Loader extends BaseObject
continue;
}
$replace = str_replace(__DIR__ . '/', '', $path->getPathname());
$replace = str_replace(APP_PATH . '/', '', $path->getPathname());
$replace = str_replace('.php', '', $replace);
$replace = str_replace(DIRECTORY_SEPARATOR, '\\', $replace);
+29
View File
@@ -3,6 +3,7 @@
defined('APP_PATH') or define('APP_PATH', __DIR__ . '/../../');
use Annotation\Annotation;
use Annotation\Attribute;
use HttpServer\Http\HttpParams;
use HttpServer\Http\Request;
use HttpServer\Http\Response;
@@ -64,6 +65,31 @@ if (!function_exists('annotation')) {
}
if (!function_exists('recursive_directory')) {
/**
* @param string $path
* @param array|Closure $callback
*/
function recursive_directory(string $path, array|Closure $callback)
{
$array = [];
$directoryIterators = new \DirectoryIterator($path);
foreach ($directoryIterators as $directoryIterator) {
if ($directoryIterator->isDir()) {
Recursive_directory($directoryIterator->getRealPath(), $callback);
} else {
$array[] = $directoryIterator;
}
}
call_user_func_array($callback, $array);
}
}
if (!function_exists('isUrl')) {
@@ -491,6 +517,9 @@ if (!function_exists('name')) {
*/
function name(string $name)
{
if (Snowflake::isMac()) {
return;
}
swoole_set_process_name($name);
}