想讓url中controller、action部分兼容兼容中劃線,中劃線更加符合SEO標準也更美觀
例如 /security/update-password 將訪問 securityController 控制器的 updatePassword 方法
每條都注冊路由麻煩
閱讀了一下代碼,在
框架核心App.php 類 getControllerAction方法添加如下代碼
$controller_class = str_replace(' ', '', ucwords(str_replace('-', ' ', $controller_class)));
$action = str_replace(' ', '', ucwords(str_replace('-', ' ', $action)));
實測可行 也不會對框架現(xiàn)有用戶產(chǎn)生影響,github發(fā)了PR,但是是第一次發(fā) 不知道是不是操作有問題群主看不到,望群主能通過下這段改動
中劃線更加符合SEO標準也更美觀
重新發(fā)pr吧,你的pr里帶了其它文件代碼,src/Auth/AuthManger.php 什么的不要提交。
$controller_class = str_replace(' ', '', ucwords(str_replace('-', ' ', $controller_class)));
$action = str_replace(' ', '', ucwords(str_replace('-', ' ', $action)));
這個寫得太繁瑣了,改成
$controller_class = str_replace('-', ' ', $controller_class);
$action = str_replace('-', ' ', $action);
看下是否ok
發(fā)錯了,替換成
$controller_class = str_replace('-', '', $controller_class);
$action = str_replace('-', '', $action);
php方法命名不能重復(fù)也不區(qū)分大小寫,所以walkor那個跟你的是一樣的效果
所以不管你是function Log/LOg/LOG/lOg/loG ... 最后->log都能調(diào)用
打個比方,你要Request-For-Something, 你要精確匹配,那么方法名只能是request_for_something, - 轉(zhuǎn) _