コード例 #1
0
ファイル: index.php プロジェクト: james-wall/tatc
function rest($json)
{
    $fakeCities = ["0" => "Boston, United States", "1" => "Shanghai, China", "2" => "Rio de Janeiro, Brazil", "3" => "Cimarron, United States", "4" => "Oslo, Norway", "5" => "Cairo, Egypt", "6" => "Cape Town, South Africa", "7" => "Venice, Italy", "8" => "New Dehli, India", "9" => "Tulsa, United States", "10" => "Reykjavik, Iceland", "11" => "San Antonio, United States"];
    $fakeCities2 = ["0" => "Rockport, United States", "1" => "Beijing, China", "2" => "Valencia, Venezuela", "3" => "Phoenix, United States", "4" => "Copenhagen, Denmark", "5" => "Casablanca, Morocco", "6" => "Addis Ababa, Ethiopia", "7" => "Florence, Italy", "8" => "Tokyo, Japan", "9" => "Indianapolis, United States", "10" => "Stockholm, Sweden", "11" => "Toronto, Canada"];
    $fakeCities3 = ["0" => "Los Angeles, United States", "1" => "Singapore, Singapore", "2" => "Santiago, Chile", "3" => "Denver, United States", "4" => "Moskow, Russia", "5" => "Nairobi, Kenya", "6" => "Honolulu, Hawaii", "7" => "Papeete, French Polynesia", "8" => "Bismarck, United States", "9" => "Sioux Falls, United States", "10" => "Seoul, South Korea", "11" => "Cancun, Mexico"];
    $fakeCity1 = $fakeCities[rand(0, 11)];
    $fakeCity2 = $fakeCities2[rand(0, 11)];
    $fakeCity3 = $fakeCities3[rand(0, 11)];
    if ($json['address_obj']['country'] != "" && $json['address_obj']['city'] != "") {
        $at = count($json['reviews']) - rand(0, count($json['reviews']));
        $str = '{ "fakeCity1": "' . $fakeCity1 . '", "fakeCity2": "' . $fakeCity2 . '", "fakeCity3": "' . $fakeCity3 . '", "realCity": "' . $json['address_obj']['city'] . ', ' . $json['address_obj']['country'] . '", "comment": "' . $json['reviews'][$at]['text'] . '", "url": "' . $json['web_url'] . '"}';
    } else {
        calls();
    }
    // $str = '{ "fakeCity1": "'.$fakeCity1.'", "fakeCity2": "'.$fakeCity2.'", "fakeCity3": "'.$fakeCity3.'", "realCity": "'.$json['address_obj']['city'].', '.$json['address_obj']['country'].'", "comment": "'.$json['reviews'][3]['text'].'", "url": "'.$json['web_url'].'"}';
    echo $str;
}
コード例 #2
0
ファイル: callAble.php プロジェクト: xiaobudongzhang/lib
function y()
{
    (yield '1');
    (yield calls("a"));
}