New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

控制器文件名规则的坑 #166

Closed
leizongmin opened this Issue May 28, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@leizongmin
Contributor

leizongmin commented May 28, 2015

在ThinkJS的文档中,Controller命名方式的描述是这样的:

控制器的名称采用驼峰法命名,且首字母大写。

而实际上,假如我有一个Controller的文件名为 AppCategoryController.js,访问地址 /AppCategory时,在大小写敏感的服务器上运行会提示 ControllerAppcategorynot found,将文件名改为AppcategoryController.js才解决

而Model里面则是区分大小写的,比如Model的文件名为AppCategoryModel.js,则能通过D('AppCategory')取得该Model,将文件改名为AppcategoryModel.js时则无法取得该Model

希望在ThinkJS中能统一这个命名规则,比如全部不区分大小写,或者是文件名与调用函数时所传递的名字参数一致。

@welefen

This comment has been minimized.

Member

welefen commented May 28, 2015

多谢建议,会尽快改为驼峰形式

另,2.0设计的时候考虑到了这些问题,已经将所有文件名都改为小写了。

@welefen welefen closed this in 388be3f May 28, 2015

@welefen

This comment has been minimized.

Member

welefen commented May 28, 2015

已经发布1.2.4版本修复了该问题。

现在访问/AppCategory,对应的Controller为AppCategoryController.js了

@itchina110

This comment has been minimized.

itchina110 commented May 29, 2015

哈哈,老雷!

@ytxbnahn

This comment has been minimized.

ytxbnahn commented Aug 21, 2018

我自己访问的链接 ‘backend/reports/salesProgress/index’
目录
2018-08-21 5 20 06
访问时 显示无backend controller
同目录下的 detail 访问没有问题
想问一下 是我的命名规则有问题 还是我有其他的错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment