rtconner Posted May 11, 2007 Share Posted May 11, 2007 Ok this is for a deployment script I'm writing in PHP. What I'm looking for is a way to load in a given php config file, and modify a variables in it and then write it again. Any ideas how to do this. Thanks Rob Quote Link to comment https://forums.phpfreaks.com/topic/50993-little-bit-of-a-hard-one/ Share on other sites More sharing options...
veridicus Posted May 11, 2007 Share Posted May 11, 2007 I would use a simple preg_replace. Or you could read it line by line and look for "variable_name=", then replace the whole line and output to a new file. Quote Link to comment https://forums.phpfreaks.com/topic/50993-little-bit-of-a-hard-one/#findComment-250901 Share on other sites More sharing options...
MadTechie Posted May 11, 2007 Share Posted May 11, 2007 or if its a short config, just write the whole thing with the mods, Quote Link to comment https://forums.phpfreaks.com/topic/50993-little-bit-of-a-hard-one/#findComment-250915 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.