php parse_ini_file
2014-09-28 14:24
267 查看
(PHP 4, PHP 5)
parse_ini_file —
Parse a configuration file
Example #2 [b]parse_ini_file() example[/b]
Constants may also be parsed in the ini file so if you define a constant as an ini value before running
parse_ini_file(), it will be integrated into the results. Only ini values are evaluated. For example:
The above example will outputsomething similar to:
parse_ini_file —
Parse a configuration file
Examples ¶
Example #1 Contents of sample.ini; This is a sample configuration file ; Comments start with ';', as in php.ini [first_section] one = 1 five = 5 animal = BIRD [second_section] path = "/usr/local/bin" URL = "http://www.example.com/~username" [third_section] phpversion[] = "5.0" phpversion[] = "5.1" phpversion[] = "5.2" phpversion[] = "5.3"
Example #2 [b]parse_ini_file() example[/b]
Constants may also be parsed in the ini file so if you define a constant as an ini value before running
parse_ini_file(), it will be integrated into the results. Only ini values are evaluated. For example:
<?php define('BIRD', 'Dodo bird'); // Parse without sections $ini_array = parse_ini_file("sample.ini"); print_r($ini_array); // Parse with sections $ini_array = parse_ini_file("sample.ini", true); print_r($ini_array); ?>
The above example will outputsomething similar to:
Array ( [one] => 1 [five] => 5 [animal] => Dodo bird [path] => /usr/local/bin [URL] => http://www.example.com/~username [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) Array ( [first_section] => Array ( [one] => 1 [five] => 5 [animal] => Dodo bird ) [second_section] => Array ( [path] => /usr/local/bin [URL] => http://www.example.com/~username ) [third_section] => Array ( [phpversion] => Array ( [0] => 5.0 [1] => 5.1 [2] => 5.2 [3] => 5.3 ) ) )
相关文章推荐
- PHP parse_ini_file()
- php中parse_ini_file方法的使用
- PHP的parse_ini_file()函数,解释结构类型php.ini格式的文件
- PHP parse_ini_file() 函数
- PHP parse_ini_file() 函数 解析配置文件
- php.ini针对文件上传的修改还有move_uploaded_file()函数对中文字符上传失败的解决方法
- Windows Server 2003 “Loaded Configuration File none”未加载php.ini的解决办法
- parse_ini_file() 函数
- 实战parse_ini_file()及扩展函数解析ini文件完整版
- Call to undefined function php_ini_loaded_file()
- centos6.5 php5.4 with-fpm 找不到php.ini Loaded Configuration File => (none)
- PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)
- PHP - Manual手册 - 附录 - php.ini 配置选项 - php.ini 核心配置选项说明 - file_uploads
- parse_ini_file() 函数的使用
- parse_ini_file()函数
- php.ini 全站,和htaccess web目录 默认头部和尾部 auto_prepend_file
- parse_ini_file() 函数
- 负载均衡-多台机子session不起效:把php.ini中file改为memcache存储
- php 多只能上传20个文件解决办法,修改php.ini 的max_file_uploads
- php write_ini_file