server/src/main/webapp/static/data/simple-persist.php
author ymh <ymh.work@gmail.com>
Tue, 01 Jan 2013 09:28:03 +0100
changeset 50 7b517a54b708
parent 47 267d67791e05
permissions -rw-r--r--
Merge last changes from rv

<?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 ($_SERVER['REQUEST_METHOD'] == 'PUT') {
        file_put_contents($file, file_get_contents("php://input"));
        echo json_encode(array("result" => "OK"));
    } else {
        echo file_get_contents($file);
    }
?>