本文整理汇总了PHP中Engine::response方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::response方法的具体用法?PHP Engine::response怎么用?PHP Engine::response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine::response方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSummoner
public function getSummoner($region, $name)
{
//$apiKey
$url = "https://{$region}.api.pvp.net/api/lol/{$region}/v1.4/summoner/by-name/" . rawurlencode($name) . "?api_key=" . apiKey;
$data = file_get_contents($url);
//set response code
Engine::$response = parseHeaders($http_response_header);
// //if the API call was successfull (summoner found)
if (Engine::$response['response_code'] == 200) {
$data = json_decode($data);
//Riot returns an object with Keys labeled by the name of who we are search. The name is made lowercase, and all spaces in the name get removed.
$index = preg_replace('/\\s+/', '', $name);
return $data->{$index};
} else {
//failed return error code instead of $data
Engine::$errorFlag = true;
return null;
}
}
示例2: init
public static function init()
{
Engine::$director = new Director();
Engine::$response = Engine::$director->initResponse();
}