ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
![](https://img.kancloud.cn/89/7a/897a2086ee7cd90836e999e2c5b8de50_968x414.jpeg) ## config目录配置文件 ~~~ 1. config.php 2. database.php 3. router.php ~~~ #### 1.config.php >框架的最重要配置文件 ~~~ <?php /* * +---------------------------------------------------------------------- * | ZrWebPHP [ WE CAN DO IT JUST CUMIN ] * +---------------------------------------------------------------------- * | Copyright (c) 2020 http://zrv7.com All rights reserved. * +---------------------------------------------------------------------- * | Author: Cumin <2937978586@qq.com> * +---------------------------------------------------------------------- */ return [ # 系统框架 # 'app' => [ 'app_name' => 'Cumin导航系统', 'app_edition' => '3.2', 'debug' => true, 'xss' => true, 'code' => 'Content-type:text/html;charset=utf-8', 'time_zone' => 'PRC', 'app_text' => '非法请求,小傻逼!', 'template_path' => 'template', 'default_module' => 'index', #默认模块名 'default_controller' => 'Index', #默认控制器名 'default_action' => 'index' #默认操作名 ], # 模板配置 # 'template' => [ 'default_template' => 'zrdao', #默认模板名 'view_path' => 'view', #视图文件存放地址 'left_delimiter' => '{', #修改左右边界符号 'right_delimiter' => '}', ], # 缓存配置 # 'cache' => [ 'cache_open' => false, #缓存开关 'cache_lifetime' => 60*60*24, #缓存有效时间 'cache_path' => RUNTIME_PATH . 'cache' .DS #缓存地址[localhost] ], # 路由配置 # 'router' => [ 'check_path' => true #路径严格模式 ] ]; ~~~ #### 2. database.php > 数据库信息配置文件 ~~~ <?php /* * +---------------------------------------------------------------------- * | ZrWebPHP [ WE CAN DO IT JUST CUMIN ] * +---------------------------------------------------------------------- * | Copyright (c) 2020 http://zrv7.com All rights reserved. * +---------------------------------------------------------------------- * | Author: Cumin <2937978586@qq.com> * +---------------------------------------------------------------------- */ /* [数据库配置文件] */ return [ # 数据库类型 # 'type' => 'mysql', # 数据库服务器 # 'dbhost' => 'localhost', # 数据库端口 # 'dbport' => 3306, # 数据库用户名 # 'dbuser' => '', # 数据库密码 # 'dbpwd' => '', # 数据库名 # 'dbname' => '', # 数据库前缀 # 'dbprefix' => 'zrdao_' ]; ~~~ #### 3. router.php > 路由规则配置文件 [以下是默认的是官网自带的路由规则] ~~~ <?php /* * +---------------------------------------------------------------------- * | ZrWebPHP [ WE CAN DO IT JUST CUMIN ] * +---------------------------------------------------------------------- * | Copyright (c) 2020 http://zrv7.com All rights reserved. * +---------------------------------------------------------------------- * | Author: Cumin <2937978586@qq.com> * +---------------------------------------------------------------------- */ /* [路由配置文件] */ /* * mvc 模块/控制器/操作的真实地址 * reg1是默认规则 [官方规范:通常默认是无伪静态时使用] * reg2是第二种规则 [官方规范:有伪静态时匹配规则] * 若mvc出现多次说明有多种伪静态链接 * */ return [ [ 'mvc' => 'admin/index/index', 'reg1' => '/?admin(?:=)?([^/&]+)?(?:&([^/&]+))*', # /?admin=view&page=77 'reg2' => '/admin(?:/)?(?:([^/&]+))?(?:&([^/&]+))*' # /admin/view?id=1&name=ok ], [ 'mvc' => 'index/index/index', 'reg1' => '^/?([\?&#].*)', #/?各种符号文字 显示首页 ] ]; ~~~