mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 23:09:10 +08:00
Use str_replace() rather than implode-explode
This commit is contained in:
@@ -615,7 +615,7 @@ abstract class Module extends Component
|
|||||||
if (isset($this->controllerMap[$id])) {
|
if (isset($this->controllerMap[$id])) {
|
||||||
$controller = Yii::createObject($this->controllerMap[$id], $id, $this);
|
$controller = Yii::createObject($this->controllerMap[$id], $id, $this);
|
||||||
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) {
|
} elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) {
|
||||||
$className = str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))) . 'Controller';
|
$className = str_replace(' ', '', ucwords(str_replace('-', ' ', $id))) . 'Controller';
|
||||||
$classFile = $this->controllerPath . DIRECTORY_SEPARATOR . $className . '.php';
|
$classFile = $this->controllerPath . DIRECTORY_SEPARATOR . $className . '.php';
|
||||||
if (!is_file($classFile)) {
|
if (!is_file($classFile)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user