windows下ThinkPHP5一些命名注意事项

1.控制器名字在浏览器上会自动地转为小写,同时采用驼峰式命名法

http://localhost/index.php/Index/Blog/read
// 和下面的访问是等效的
http://localhost/index.php/index/blog/read
http://localhost/index.php/Index/BlogTest/read
// 和下面的访问是等效的
http://localhost/index.php/index/blogtest/read
http://localhost/index.php/Index/blog_test/read

如果想要严格区分大小写,则在config.php里把url_convert改为false。

// 是否自动转换URL中的控制器和操作名
'url_convert'            => false,

2.视图名称

视图名称如果要和控制器名字保持一致,也同样需要满足驼峰式命名和全部字母转为小写的原则。

3.模型名称

model下的php文件对应与数据库中的文件,需要与数据库中表的名称保持一致,同时首字母需要大写。

如果想把windows上的项目放到Linux服务器上的话,切记一些大小写的规范(Linux是严格区分大小写的)。

 

猜你喜欢

转载自blog.csdn.net/ljcgit/article/details/81189094