Re: Edit a file
| From: | shaun | Date: | Sun, 18 May 2003 15:18:00 +0000 |
| Subject: | Re: Edit a file | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148087@lists.php.net to get a copy of this message | ||
Thanks for your reply, but this question is different!
what i am trying to do is create a script that replaces a certain part of a
page e.g. everything between the <script> </script> tags.
The problem i found with the fopen() function is that writing to a file
automatically wipes the original content from the file...
"David Otton" <phpmail@jawbone.freeserve.co.uk> wrote in message
news:lf7fcv0vg7vvgoanbpr0udt2bnpfs7iq2j@4ax.com...
> On Sun, 18 May 2003 15:33:05 +0100, you wrote:
>
> >How can i open a file and change the contents of everything in the file
that
> >lands between the <script> </script> tags?
>
> I'm sure this is the second time you've asked this question, and you
already
> got one answer with example code. What exactly are you trying to
accomplish?
>
> Open a file: fopen()
>
> http://www.php.net/manual/en/function.fopen.php
>
> Read the contents of a file: file(), fread(), fgets(), etc.
>
> http://www.php.net/manual/en/ref.filesystem.php
>
> To modify a string once it's in memory: string and regex functions
>
> http://www.php.net/manual/en/ref.strings.php
> http://www.php.net/manual/en/ref.pcre.php
> http://www.php.net/manual/en/ref.regex.php
>
> Without a more specific question, you're unlikely to get more specific
help.
>