如何使用PHP读写ini文件 [英] How to read and write to an ini file with PHP

查看:99
本文介绍了如何使用PHP读写ini文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找官方的php文档,但是找不到我想要的东西.

I've been looking around the official php documentation but I'm unable to find what I'm looking for.

http://php.net/manual/en/function.parse-ini-file .php

例如,我只想要一个函数来编辑和读取php ini文件中的值,

I just want a function to edit and read the value from the php ini file, for instance,

[default_colors]
sitebg = #F8F8F8
footerbg = #F8F8F8
link = #F8F8F8
url = #F8F8F8
bg = #F8F8F8
text = #F8F8F8
border = #F8F8F8

lu_link = #F8F8F8
lu_url = #F8F8F8
lu_bg = #F8F8F8
lu_text = #f505f5
lu_border = #F8F8F8

  1. 如何读取属于"lu_link"或"footerbg"的值?
  2. 如何为这些地点写一个新值?

推荐答案

PEAR Config_Lite包可以非常轻松地为您完成几乎所有工作(包括读写).在此处查看: http://pear.php.net/package/Config_Lite

The PEAR Config_Lite package can do almost all the work (both reading and writing) for you super-easily. Check it out here: http://pear.php.net/package/Config_Lite

这篇关于如何使用PHP读写ini文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆