I was wondering if there was a way to move the cursor after opening a file using:
Such that the cursor is two lines up.
Code
fopen("file", "a");Such that the cursor is two lines up.
|
PHP
PHP Cursor Positioning |
|
PHP Code You see, Doctor, God didn't kill that little girl. Fate didn't butcher her and destiny didn't feed her to those dogs.
If God saw what any of us did that night he didn't seem to mind. From then on I knew... God doesn't make the world this way. We do. (Apr 11, 2019 01:48 PM)Jack Drake Wrote: Thanks a lot, but unfortunately it didnt work. I guess what you want is that lines are always being added on top of file. That you can achieve like this: PHP Code (Apr 11, 2019 02:05 PM)Jack Drake Wrote: The issue is that the file everything is appended from the bottom and it needs to be above the first bracket for json. You should show us some more code to be able to help you properly.
The file is in json and it has information that can't be posted here, but the php file is appending information into the file. Now, the issue is that when whenever i append data it adds it into the file at the end
Code {It doesn't put the info inside the curly braces, so that's why I want to move the cursor up 2 lines to append it there. (Apr 11, 2019 04:09 PM)Jack Drake Wrote: The file is in json and it has information that can't be posted here, but the php file is appending information into the file. Now, the issue is that when whenever i append data it adds it into the file at the end First retrieve the content of your file (file_get_contents) & store it in a variable ($content) json_decode its value, add your wanted datas to your array json_encode & put the content back to it's file. PHP Code ![]()
“Whatever Your Mind Can Conceive and Believe, It Can Achieve.” – Napoleon Hill
|
|
|
| Possibly Related Threads... | |||
| Thread / Author | Replies | Views | Last Post |
| [PHP] by DopeishApr 24, 2017 03:28 PM | 7 | 223 |
Apr 24, 2017 03:28 PM Last Post: Nachfolger |
| [PHP] by blackknight_Aug 2, 2014 08:35 AM | 1 | 91 |
Aug 2, 2014 08:35 AM Last Post: AppleJuice |
| [Javascript] by Melkor333Jun 23, 2014 12:37 PM | 2 | 93 |
Jun 23, 2014 12:37 PM Last Post: Melkor333 |