改名
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user