vbnullchar Posted September 7, 2006 Share Posted September 7, 2006 hi everyone, how can i read/write a config file heres my config file >> config.cfg <<[topic]title = "sample title"[sub-topic]sub_title = "sample sub title"[rate]rate1 = 1thanks Link to comment https://forums.phpfreaks.com/topic/19983-config-file-help/ Share on other sites More sharing options...
tomfmason Posted September 7, 2006 Share Posted September 7, 2006 You might want to look into [url=http://us2.php.net/manual/en/function.fread.php]fread[/url] and [url=http://us2.php.net/manual/en/function.fwrite.php]fwrite[/url]. Good Luck,Tom Link to comment https://forums.phpfreaks.com/topic/19983-config-file-help/#findComment-87580 Share on other sites More sharing options...
vbnullchar Posted September 7, 2006 Author Share Posted September 7, 2006 hi tom, thanks for the reply. how about if i want to modify a certain value. Link to comment https://forums.phpfreaks.com/topic/19983-config-file-help/#findComment-87589 Share on other sites More sharing options...
tomfmason Posted September 7, 2006 Share Posted September 7, 2006 this is some what complex and you may run into serveral issues. What I would do is have a table in a db with the fields that I want in my file. Then if I need to change a certain field, I would update the db then rewrite the file. It is easier to add a new line(with out a db.) then it is to edit a line. This is because if you are going to have multipule lines within your topic = " "; it will be very difficult to read inbetween the "" . Were as if you just rewrote the file from a db it would only take seconds and you would know that you got it right..Good Luck,Tom Link to comment https://forums.phpfreaks.com/topic/19983-config-file-help/#findComment-87598 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.