本文整理汇总了PHP中cookie::developer方法的典型用法代码示例。如果您正苦于以下问题:PHP cookie::developer方法的具体用法?PHP cookie::developer怎么用?PHP cookie::developer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cookie
的用法示例。
在下文中一共展示了cookie::developer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
function request($type, $url, $get = [], $post = [])
{
$developer = cookie::developer();
if ($developer) {
$get['_mode'] = 'developer';
}
$request = ['method' => $type, 'protocol_version' => '1.1', 'header' => 'Connection: Close'];
foreach ($post as $name => &$param) {
if (is_array($param) and empty($param)) {
$param = '_empty_array';
}
}
if (!empty($post)) {
$request['header'] .= "\r\nContent-type: application/x-www-form-urlencoded";
$request['content'] = http_build_query($post);
}
$ctx = stream_context_create(['http' => $request]);
$response = file_get_contents($this->endpoint . (empty($get) ? $url : $url . '?' . http_build_query($get)), false, $ctx);
$object = json::decode($response, true);
if (is_null($object)) {
if ($developer) {
var_dump($response);
die;
} else {
throw new Exception("Error Processing Request", 1);
}
}
$content = $object['content'];
return (is_object($content) or is_array($content) and array_values($content) !== $content) ? (object) $content : $content;
}