Lol5916 Posted August 24, 2008 Share Posted August 24, 2008 $p = $_POST['log'] $l = file_put_contents(file.php) $log = str_replace("replace", "", $l) How do I make it so that the word "replace" in "file.php" get's replaced by the output of $p?(form "log") Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/ Share on other sites More sharing options...
DeanWhitehouse Posted August 24, 2008 Share Posted August 24, 2008 do you not need to do , fopen and fwrite. Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624323 Share on other sites More sharing options...
DarkWater Posted August 24, 2008 Share Posted August 24, 2008 No Blade, he can just use file_put_contents(). Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624326 Share on other sites More sharing options...
Lol5916 Posted August 24, 2008 Author Share Posted August 24, 2008 So how do you use that to use file_put_contents with str_replace to edit something in a file? Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624328 Share on other sites More sharing options...
unrelenting Posted August 24, 2008 Share Posted August 24, 2008 $p = $_POST['log'] $l = file_get_contents(file.php) $log = str_replace("replace", "", $l) How do I make it so that the word "replace" in "file.php" get's replaced by the output of $p?(form "log") Try: $p = $_POST['log'] $l = file_get_contents(file.php) $log = str_replace("replace", $p, $l) Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624329 Share on other sites More sharing options...
DarkWater Posted August 24, 2008 Share Posted August 24, 2008 @unrelenting: You actually need to save the file though. =P Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624333 Share on other sites More sharing options...
unrelenting Posted August 24, 2008 Share Posted August 24, 2008 @unrelenting: You actually need to save the file though. =P I guess I just don't understand what that code is doing. I just assumed he just wanted that str_replace edited to suit his needs. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624336 Share on other sites More sharing options...
Lol5916 Posted August 24, 2008 Author Share Posted August 24, 2008 I have code in a file that needs to be edited with information from user input. Quote Link to comment https://forums.phpfreaks.com/topic/121104-help/#findComment-624338 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.