【TP】ThinkPHP5公共模块的设置与使用

【TP】ThinkPHP5公共模块的设置与使用

2023年6月23日发(作者:)

【TP】ThinkPHP5公共模块的设置与使⽤use appcommonUser AS commonUser 这种取别名的⽅式, 也可以这么使⽤, ⽐如 index下的User类要继承common模块的下的User类:class User extends appcommoncontrollerUser {}这⾥⼀定要在app前加"", 告诉⾃动载⼊函数 app是根命名空间同样的道理, 在使⽤common模块下的User类, 可以这样做: $commonUser=new appcommoncontrollerUser;⽅法都是可⾏的,看哪种⽤起来⽅便TP5.0是可以访问common模块的, 只需要把⽂件中的 // 禁⽌访问模块'deny_module_list' => ['common'], 把common去掉, 注意这⾏代码不可以注释, 注释了程序不可以执⾏. 最好是在公共配置⽂件修改deny_module_list配置项.

发布者:admin,转转请注明出处:http://www.yc00.com/web/1687517308a16338.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信