client/data/simple-persist.php
author ymh <ymh.work@gmail.com>
Thu, 16 Aug 2012 15:59:25 +0200
changeset 13 6d0e0100f4e8
parent 5 67085e6281e5
child 18 4423bfcd8f9f
permissions -rw-r--r--
Clean server, copy dep from client

<?php
    header('Content-Type: application/json; charset=utf-8');
    $file = "dynamic-data.json";
    if (isset($_GET['reset']) && $_GET['reset']) {
        $resetfile = "test-data.json";
        file_put_contents($file, file_get_contents($resetfile));
    }
    if (isset($_POST['data'])) {
        file_put_contents($file, $_POST['data']);
        echo json_encode(array("result" => "OK"));
    } else {
        echo file_get_contents($file);
    }
?>