Jump to content

Scaryminds

New Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Scaryminds

  1. Thanks, finally got it happening with json after much muttering: <!DOCTYPE html> <head lang="en"> <title>Test JSON array thingy</title> </head> <body> <?php $filename = "test.txt"; $myarray['First'] = "Hello World"; $myarray['Second'] = "Another World"; $myarray['Third'] = "Finding Nemo"; // write the array file_put_contents($filename, json_encode($myarray)); // test getting that bad boy back $txtarray = json_decode(file_get_contents($filename), true); // access title of $book array $value = $txtarray['Second']; echo "<p>$value</p>"; ?> </body> </html>
  2. This one has me stumped, have tries json and file_put_contents() to no avail. Okay have a text file, see contents below: <?php site['subTitle'] = "Welcome to the Site"; ?> On an administration page I want to change "Welcome to the Site" to "This is Sydney" or some such, and then write out the array so I get <?php site['subTitle'] = "This is Sydney"; ?> Can't work out how to write the array to the text file in the format above, Thanks in advance team.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.