本文整理汇总了PHP中KRequest::scheme方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::scheme方法的具体用法?PHP KRequest::scheme怎么用?PHP KRequest::scheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KRequest
的用法示例。
在下文中一共展示了KRequest::scheme方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set
/**
* Set a variable in the request. Cookies and session data are stored persistently.
*
* @param mixed Variable identifier, prefixed by hash name eg post.foo.bar
* @param mixed Variable value
*/
public static function set($identifier, $value)
{
list($hash, $keys) = self::_parseIdentifier($identifier);
// Add to _REQUEST hash if original hash is get, post, or cookies
if (in_array($hash, array('GET', 'POST', 'COOKIE'))) {
self::set('request.' . implode('.', $keys), $value);
}
// Store cookies persistently
if ($hash == 'COOKIE' && strpos(KRequest::scheme(), 'http') !== false) {
// rewrite the $keys as foo[bar][bar]
$ckeys = $keys;
// get a copy
$name = array_shift($ckeys);
foreach ($ckeys as $ckey) {
$name .= '[' . $ckey . ']';
}
if (!setcookie($name, $value)) {
throw new KRequestException("Couldn't set cookie, headers already sent.");
}
}
// Store in $GLOBALS
foreach (array_reverse($keys, true) as $key) {
$value = array($key => $value);
}
// Add the global if it's doesn't exist
if (!isset($GLOBALS['_' . $hash])) {
$GLOBALS['_' . $hash] = array();
}
$GLOBALS['_' . $hash] = KHelperArray::merge($GLOBALS['_' . $hash], $value);
}