跳至主要内容

配置文件

安装 Pagekit 时,Pagekit 配置文件会自动生成。如果你想手动更改配置设置,本文会解释文件的语法和内容。

通常,安装程序创建配置文件后,你不需要再去调整配置文件。更改配置的正常方式是通过Pagekit管理面板中的系统>设置config.php

有时手动编辑该文件仍然必要且有用,例如在排查故障安装或将现有 Pagekit 安装迁移到新服务器时。

在下面的代码列表中,你可以看到一个示例配置,包含了最常见的设置。

通常你只有一个数据库连接。示例包含这两个示例,以展示不同数据库驱动程序的配置工作方式。Pagekit 只会使用该连接(本例中使用了)。defaultsqlite

'database' => [
  'default' => 'sqlite',     // default database connection
  'connections' => [         // array of database connections
    'sqlite' => [            // database driver name, here: sqlite
      'prefix' => 'pk_',     // prefix in front of every table
    ],
    'mysql' => [             // database driver name, here: mysql
      'host' => 'localhost', // server host name
      'user' => 'user',      // server user name
      'password' => 'pass',  // server user password
      'dbname' => 'pagekit', // database name
      'prefix' => 'pk_'      // prefix in front of every table
    ],
  ]
],
'system' => [
  'secret' => 'secret'       // a secret string generated during installation
],
'system/cache' => [
  'caches' => [
    'cache' => [
      'storage' => 'auto'    // the cache method to be used, if enabled
    ]
  ],
  'nocache' => false         // the cache state - disable entirely by setting to true
],
'system/finder' => [
  'storage' => '/storage'    // relative path to a folder used for uploads, cache etc.
],
'application' => [
  'debug' => false           // debug mode state, enable while developing to get debug output
],
'debug' => [
  'enabled' => false         // debug toolbar state, enable to get information, about requests, routes etc.
]