Fixed deep directory prefix

This commit is contained in:
张城铭 2019-07-01 17:51:26 +08:00
parent 4a1c2e243f
commit b833fd2f97

View File

@ -200,8 +200,9 @@ class DispatcherFactory
{
if (! $prefix) {
$handledNamespace = Str::replaceFirst('Controller', '', Str::after($className, '\\Controller\\'));
$handledNamespace = Str::replaceArray('\\', ['/'], $handledNamespace);
$handledNamespace = str_replace('\\', '/', $handledNamespace);
$prefix = Str::snake($handledNamespace);
$prefix = str_replace('/_', '/', $prefix);
}
if ($prefix[0] !== '/') {
$prefix = '/' . $prefix;