data::save PHP Method

save() protected static method

protected static save ( $data )
    protected static function save($data)
    {
        file_put_contents(__DIR__ . self::$filename, json_encode($data));
    }

Usage Example

コード例 #1
0
        echo "<span style='color:red;'>" . _("<b>Error</b>: this athlete already flashed this boulder!") . "</span>";
        die;
    }
    if ($postdata["ascent"] == 1) {
        $checkdup = new data("attempts", "filter:athlete='{$checkdup_athlete}' and boulder='{$checkdup_boulder}' and ascent='0' and sector='{$checkdup_sector}'");
        if (!isset($checkdup->{0}->id)) {
            $attempt->ascent = 2;
        }
    }
    //$bould=get_boulder($postdata["sector"],$postdata["boulder"]);
    //vd($attempt);
    //die;
    //$attempt->boulder_letter=1;
    //die;
    //die;
    if ($attempt->save()) {
        //echo "<b>Done</b>! added to queue...";
    } else {
        echo "<span style='color:red;'>" . _("<b>Error</b>: processing your request, check your post data and try again or contact our support.") . "</span>";
        die;
    }
    //header("Refresh:0");
    //echo"aaaa";
    echo _("<b>Done</b>: registered! :)");
    //header("Location: $homeurl"."/#attempt");
    //
    echo '
	<script>
		window.location.replace("/#attempt");
		location.reload();
	</script>