Re: replacing file contents

From: Date: Mon, 11 Apr 2005 10:13:07 +0000
Subject: Re: replacing file contents
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25825@lists.php.net to get a copy of this message
Hi I, for one, have never done this, but if you are working with html files, I suppose you open it with your browser ? Have you cleared the cache, or at least forced the browser to re-open the file ? If you edit the file after the change using a text editor, do you see the changes, or not ? Luis Aidal wrote:
Hi NG. I'm having trouble searching through a file and swapping specific phrases with other phrases. I'm opening a html-file and i wish to replace "index2.php?someVar=SomeValue" with somthing else but I can't get this to work properly. first i open the html file and read all it's contents into a var... let's call that one $file_contents for this example. I'm currently trying using: $altered_file_contents = eregi_replace("index2.php?someVar=SomeValue","somevar_somevalue.html", $file_contents); Then I delete the file i opened, create a new one with the same name and write the $altered_file_contents into it and close it. But when I open it and check the line numbers that should have been altered, they haven't been toutched at all, they still show the first link. What am I doing wrong? Why aren't eregi_replace() doing what I think it should? Please help... /Aidal


« previous php.windows (#25825) next »