小优化
- Dominant language
- PHP
- Stars
- 2.7k
- Forks
- 251
- PR merge metrics
- No merged PRs in 30d
Description
vendor\workerman\webman-framework\src\App.php:486
loadController 这个函数
**if (\is_dir($file) || false === \strpos(strtolower($file), '/controller/') || $spl_file->getExtension() !== 'php') {
continue;
}**
改为
if (\is_dir($file) || false === \strpos(strtolower($file), DIRECTORY_SEPARATOR.'controller'.DIRECTORY_SEPARATOR) || $spl_file->getExtension() !== 'php') {
continue;
}
对window 会好一些
http://127.0.0.1:19730/admin/menu.index/index 比如更深的控制器
class Server extends App{
balabalabala......
protected static function parse_controller_action($path){
$suffix = config('app.controller_suffix', '');
$path_explode = explode('/', trim($path, '/'));
$app = !empty($path_explode[0]) ? $path_explode[0] : 'index';
$controller = $path_explode[1] ?? 'index';
**$controller=str_replace('.','\\\',$controller);**// 我这边支持多层控制器的方法
$action = $path_explode[2] ?? 'index';
if (isset($path_explode[2])) {
$controller_class = "app\\$app\\controller\\$controller$suffix";
if ($controller_action = static::get_controller_action($controller_class, $action)) {
return $controller_action;
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in vendor/workerman/webman-framework/src/App.php at loadController around line 486 and inspect how controller paths are matched. Check the Windows path case and the nested controller example such as admin/menu.index/index. Done means controller discovery works for these paths without breaking existing PHP controller loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100