Heim  >  Artikel  >  Backend-Entwicklung  >  CodeIgniter框架基本配置文件config.php介绍_PHP教程

CodeIgniter框架基本配置文件config.php介绍_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:34:06707Durchsuche

CodeIgniter 基本配置信息在 application/config/config.php 文件,本文详细讲解每一个基本配置选项,从而快速掌握 CodeIgniter 进行开发。

$config['base_url'] = "http://www.bkjia.com/"。 您网站的网址,CodeIgniter 会根据这个网址来生成链接、表单地址等。

$config['index_page'] = "index.php" CodeIgniter 根目录下的 index.php 文件名,CodeIgniter 会使用它来生成链接地址。如果使用隐藏 index.php 的 URL,将其设置为空字符串:$config['index_page'] = ""。

$config['uri_protocol'] = "AUTO" CodeIgniter 生成 URL 使用的格式,设置为“AUTO”自动探测。如果链接不能正常工作,可以尝试以下值:PATH_INFO、QUERY_STRING、REQUEST_URI、ORIG_PATH_INFO。

$config['url_suffix'] = "" 。CodeIgniter 产生链接时使用的 URL 后缀,如果要实现伪静态,可以设置 $config['url_suffix'] = ".html"。

$config['language'] = "english" 。CodeIgniter 程序默认使用的语言

$config['charset'] = "UTF-8" 。CodeIgniter 程序默认使用的字符集

$config['enable_hooks'] = FALSE 。是否启用钩子,钩子功能使得您可以在不修改系统核心文件的基础上来改变或增加系统的核心运行功能。

$config['subclass_prefix'] = 'MY_' 。设置扩展 CodeIgniter 类库时使用的类名前缀

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-' 。设置 CodeIgniter URL 中允许使用的字符,这是一个正则表达式。当访问者试图访问的 CodeIgniter URL 包含其它字符时,会得到一个警告。应该尽量限制 CodeIgniter URL 使用的字符来提高安全性,可以有效的过滤注入攻击。如果设置为空,允许使用所有字符,强烈建议不要这么做。

$config['enable_query_strings'] = FALSE 。CodeIgniter URL 默认使用分段的 URL,此选项也允许 CodeIgniter 开启查询字符串形式 URL。您可以使用查询字符串来传递要访问的控制器和函数。例如: index.php?c=controller&m=method。CodeIgniter 默认使用分段的 URL,查询字符串的 URL 很多特性不被支持。

$config['controller_trigger'] = 'c' 。CodeIgniter 将查询字符串中此选项对应的值当做 CodeIgniter 控制器的名字。

$config['function_trigger'] = 'm' 。CodeIgniter 将查询字符串中此选项对应的值当做 CodeIgniter 控制器方法的名字

$config['log_threshold'] = 0 。启用错误日志,设置记录哪些类型的错误。

  •  0 = 关闭错误日志记录
  •  1 = 记录错误信息
  •  2 = 记录调试信息
  •  3 = 记录通知信息
  •  4 = 记录所有信息

$config['log_path'] = ""。如果您不想使用默认的错误日志记录目录配置(system/logs/),可以设置完整的服务器目录。

$config['log_date_format'] = 'Y-m-d H:i:s' 。CodeIgniter 错误日志时间格式

$config['cache_path'] = ""。如果您不想使用默认的缓存目录(system/cache/)来存储缓存,可以设置完整的服务器目录

$config['encryption_key'] = "" 。CodeIgniter 使用的密钥

$config['global_xss_filtering'] = FALSE。 是否对输入数据(GET、POST)自动过滤跨脚本攻击

$config['compress_output'] = FALSE。 启用Gzip压缩达到最快的页面加载速度

$config['time_reference'] = 'local'。 设置时间格式:"local"、"GMT"

$config['rewrite_short_tags'] = FALSE。 如果您想要使用短标记,但 PHP 服务器不支持,CodeIgniter 可以通过重写短标记来支持这一功能。

$config['proxy_ips'] = ""。 如果访问者通过代理服务器来访问您的网站,您必须设置代理服务器 IP 列表,以识别出访问者真正的 IP。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/752328.htmlTechArticleCodeIgniter 基本配置信息在 application/config/config.php 文件,本文详细讲解每一个基本配置选项,从而快速掌握 CodeIgniter 进行开发。 $config['bas...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn