get - PHP append content to a file (reading/writing of a file) -
i'm still rather new php , i'm working on trying kinda this;
down.php?days=numberhere
take number , write file , display file in spot, know how display file i'm not sure how write file if point me in direction learn or me out that'd great, i've looked around few days , haven't seen help
thanks
edit:
i've re-read question , of answers, , don't know if clear in i'm trying accomplish; basically, if cooldowns.txt has "10" , ?days=7, cooldowns.txt needs become 17 instead of adding numbers file
update: i've come based on replies question, i'm wondering if there's way make add ? (ie = 1 + whatever file has, if file has 25 , = 1 file becomes 26)
from quote:
i've come based on replies question, i'm wondering if there's way make add ? (ie = 1 + whatever file has, if file has 25 , = 1 file becomes 26)
// retrieve data file.txt , type cast integer $current = (int) file_get_contents('file.txt'); // increment $current, equivalent $current=$current+1; $current++; // write file_put_contents('file.txt', $current);
Comments
Post a Comment