Youcanwritethemto a newfile, oryoucanupendanoldfileandthereforethatinformationwillbestoreduntilyougetaroundtodeletingit.
Sothat's wherethefileputcontentsfunctioncomesinisyou'reabletotakethevariablesandputtheminto a file.
Sowiththat, let's goovertothecomputerso I cangiveyou a demonstrationonhowthisworksbecausethisiswherewestarttogetintotheniftyneatstuff I thinkwithPHPandactuallystarttobeabletodothingsthatarereallyfunctionalintherealworld.
Sothisis a littlescriptthatitcreatedtoshowyouhowtowritetoe a fileusingfileputcontents.
Andsowithherewiththatparticularvariable, we'rejustgoingtocall a dollarsignfiletomakeiteasierequalssinglequotationmarksandthenwhateverthenameofthefileis.
Soifyouwantustobe t x t a t m htmlPHPagain, youcanyoucanhavePHP, right?
Sowe'rejustgoingtoprintoutitorationspace, andthenwhateverthetimeis, andthensincewe'regoingtobelookingatthiswith a Webbrowser, thenwe'regoingtodo a break.
Andthenagain, I wouldargueforyouguystodothefileunderscoreupendjustbecauseit'llmakeyourlifeeasierwhileyou'retroubleshootingAtleastinthebeginningandthengofromtherethisagainhastobeallinuppercase.
It's notthatyoucan't usefilesas a securewaytostoredata.
It's justprobablynotthebestwaytodoit.
Andunlessyoureallyunderstandwhatyou'redoing, I wouldsaythatthat's notwhatyoushoulddo.
Sothisisgoodforthings.
Again, let's sayyouhad a signuplistsoyouhave a signuplistforanevent, andyoujustwantpeopletosignin.
Sobasicallypeopleongo, theycanputtheirname, itdumpstheirnameandthat's it.
That's prettysecure.
Uh, ifyouwanttoknowsomethinglike T shirtsize, solet's sayyouhave a companyororganizationandyouwanttogetpeople T shirtsforthatcompanyagain.
Theirname, their T shirtsize, that's that's a goodwaytostoreinformationagain.
Logfilesdobecarefulwiththelogfiles.
Ifyoustartdumpingintoomany, I p addressestoomuchinformationthatthatmightbeconfidential.
Thenagain, youcouldhaveproblemsif a hackerisabletoviewthoselogfilesandthenrealized, Oh, thisisyouractivedirectoryserverandthisisyourexchangeserverandthisisyourotherserver, andthisiswhologsinsoonandsoforth.
Sodobecarefulwiththelogfiles, too.
Butthat's reallyallthereistowritingto a fileagain.
Thisis a verysimpleconceptwhereitgetscomplicatedandisintherealworld, whereyouhavetodecidewhat's appropriatetowriteto a file, what's notappropriatetowriteto a file.
Andthenagain, onceyouwroterightto a file, howareyougoingtointeractwiththatdataagain?
Thiscomesbacktotheideaofhowdoyouwanttoprintdatato a file?
Doyouwannaprintdatathat's viewableby a Webbrowserorprintdatathat's viewableby a texteditor.