You are here: Re: Editing a (config) file « PHP Programming Language « IT news, forums, messages
Re: Editing a (config) file

Posted by David Haynes on 07/07/06 11:54

Sonnich wrote:
> Hi
>
> I have a file with some configation in it... I am wondering how I
> correct single values in there.
>
> The most secure is to recreate the file, then rename it.
>
> But is there a way to correct a line in the text file?
> setting1=bla -> setting1=blablabla
>
> Needless to say, there are things in there I'd like to keep at all
> times.
>
> BR
> Sonnich

I would read the file into an associative array, update the value based
on the key, write a new file, rename it to the original. I might also
flock() the original configuration file if the operating system does not
support atomic rename/move.

-david-

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация