Пример #1
0
<?php

include_once "models/Ret.php";
include_once "models/MeiShi.php";
header("Content-type: application/json; charset=utf-8");
$meishi = new MeiShi();
$meishi->GetAllMeiShi();
Пример #2
0
<?php

include_once "models/Ret.php";
include_once "models/MeiShi.php";
header("Content-type: application/json; charset=utf-8");
try {
    $title = $_POST["title"];
    $note = $_POST["note"];
    $image = $_POST["image"];
    $lat = $_POST["lat"];
    $lon = $_POST["lon"];
    $province = $_POST["province"];
    $city = $_POST["city"];
    $street = $_POST["street"];
    $meishi = new MeiShi();
    $meishi->CreateMeiShi($title, $note, $image, $lat, $lon, $province, $city, $street);
    $ret = new Ret();
    $ret->code = "0";
    echo json_encode($ret);
} catch (CreateMeiShiException $e) {
    $err_str = $e->getMessage();
    $ret->code = '1';
    $ret->msg = $err_str;
    echo json_encode($ret);
}