Jump to content

writing data to a file


SFB
 Share

Recommended Posts

I was wondering if there was a way to write data in a file just before ?>. It would be helpfull. I could just remove ?> and putt it back in when i write over the file again but I dont feel like doing it that way.

Link to comment
Share on other sites

I'm not sure what you're talking about, are you writing code to a PHP file and want to start inside the ?> ? There's not a way to start at a specific offset. Just remove the last few characters and then include them in what you write.

Link to comment
Share on other sites

You can open the file in read mode, read backwards 2 characters, put that into a variable, then read backwards to the beginning and put that in a variable. Then you can close the file and open it again in write mode. You can then re-write all of the beginning from the second variable, append whatever you want to write, and then put on the first variable to close it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...