| 状态 | 草稿 |
|---|---|
| Todo | How config entries merge, Proof read |
| 官方最后更新时间 | 2008/11/07 23:26 |
对信息检索和配置项可参见 Kohana 页面。
配置文件的配置参数均放在 $config 的数组里面。
例如
$config['site_domain'] = 'localhost/';
下面是系统读取配置文件的顺序方式。
application > modules > system
也就是说,application 文件夹里的配置文件高于其他文件夹的配置文件,系统首选读取 application 文件夹里的配置文件,然后依次读取 modules 文件夹下面的各个扩展的配置文件。如果 application 文件夹里的配置文件不存在则读取 system 文件夹里的配置文件。默认 application 文件夹里的没有配置文件,只需把 system 文件夹里的配置文件 config.php 复制到 application/config 目录下面。
配置文件 Config.php 是 Kohana 的核心,而且此文件必须放在 application/config 目录下面
/*
* Options:
* site_domain - domain and installation directory
* site_protocol - protocol used to access the site, usually HTTP
* index_page - name of the front controller, can be removed with URL rewriting
* url_suffix - an extension that will be added to all generated URLs
* internal_cache - whether to store file paths and config entries across requests
* output_compression - enable or disable GZIP output compression
* global_xss_filtering - enable or disable XSS attack filtering on all user input
* enable_hooks - enable or disable hooks.
* log_threshold - sets the logging threshold
* log_directory - directory to save logs to
* display_errors - whether to show Kohana error pages or not
* render_stats - render the statistics information in the final page output
* extension_prefix - filename prefix for library extensions
* modules - extra Kohana resource paths,
*/
cache.php
高级缓存配置文件。可设置缓存时间和垃圾回收。详情请参见 缓存库(Cache Library)。
captcha.php
验证码图片配置文件。详情请参见 验证库(Captcha Library)。
cookie.php
Cookies配置文件。详情请参见 Cookie 辅助函数。
credit_cards.php
验证信用卡配置文件。
database.php
数据库配置文件。支持多种数据库,详情请参见 数据库配置。
email.php
Email发送配置文件。详情请参见 Email 辅助函数。
encryption.php
设置加密比如密钥,模式和密码。详细请参见 加密库(Encrypt Library) 。
http.php
HTTP-EQUIV 标签类型配置文件。
image.php
图片处理驱动配置文件。如 GD 或 ImageMagick。
inflector.php
详情请参见 Inflector Helper。
locale.php
设置应用程序的本地和时区,详情请参见 Internationalization。
mimes.php
设置可用的 mime-types。 (详情请参见 validation/upload 页面?)
pagination.php
设置分页,详情请参见 分页库(Pagination Library)。
payment.php
支付设置。
profiler.php
设置配置(profiler)信息是否显示。 详情请参见 分析库(Profiler Library)。
routes.php
设置 Kohana 系统默认主页,包括 _default 和 _allowed。详情请看 路由(Routing)。
session.php
配置 session 及驱动。详情请看 Session 库。
sql_types.php
设置 SQL 数据类型
upload.php
设置上传目录。
user_agents.php
可以给爬虫或浏览器设置有用的信息。详情请看 user_agent。
view.php
允许的文件类型 (不赞成?)
详情请参见Kohana 类