Yii2:404 尝试转到多个单词模型的索引时出错



我尝试转到名为"ServicioPeluquero"的模型的索引,但它有 2 个单词,所以当我尝试访问它的索引时,它无法显示。我尝试了这个网址:

localhost/yii2basic/web/index.php?r=serviciopeluquero
localhost/yii2basic/web/index.php?r=servicioPeluquero
localhost/yii2basic/web/index.php?r=servicio_peluquero

如果能提供帮助,我将不胜感激。

模型如何命名并不重要,重要的是控制器名称。应使用连字符作为驼峰大小写控制器的单词分隔符。因此,假设您的控制器名称是ServicioPeluqueroController,您应该使用:

localhost/yii2basic/web/index.php?r=servicio-peluquero

最新更新