Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Newbie PHP Question
April 2, 2006, 7:14 am
rate this thread
have a file that I use VI to open up and add information to. I would like
to create a web page that allows me to do two things with this file. First,
I need to search the file for a string of text. If what I am looking for is
there, I do not need to do anything else. If the text is not there, I need
to edit the file, add information to the bottom of the text and save it. A
bonus would be to make a dated backup copy of the file before saving.
I guess my main question is, will PHP allow me to do this and are there any
links that I coud go to that would provide some insight in to how to do it.
My PHP books do not go into detail on searching or editing text files.
Re: Newbie PHP Question
Yes php can do all this. I suggest you study the online manual for
strpos() for the search and file functions for the other operations.
For instance, file_get_contents() gets the contents of the file into a
string and strpos() allows you to search that haystack for a needle.
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/