本文整理匯總了PHP中HTTPRequest::getContext方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTTPRequest::getContext方法的具體用法?PHP HTTPRequest::getContext怎麽用?PHP HTTPRequest::getContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::getContext方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: save
function save($id, $to_omit = array(), $life_count = 0)
{
if (!Session::$active || !preg_match('/^\\w+$/', $id)) {
return false;
}
return Session::setParameter("restore_{$id}", serialize(HTTPRequest::getContext($to_omit)), $life_count);
}
示例2: preg_match
<?php
include "../Session.php";
include "../HTTPRequest.php";
// $_GET, $_POST, $_COOKIE = $_REQUEST
/*
$_REQUEST['name']
preg_match('/^\w+$/', $_REQUEST['name']);
$name = stripslashes($_REQUEST['name']);
*/
var_dump(HTTPRequest::isParameter('one'));
$_GET['one'] = true;
$_GET['two'] = '2';
var_dump(HTTPRequest::isParameter(array('one', 'two')));
$_GET['one'] = '1';
var_dump(HTTPRequest::isParameter(array('one', 'two'), '/^\\d+$/'));
$_GET = array();
var_dump(HTTPRequest::isParameter(array('one', 'two'), null, 'GET'));
echo "============================================================== <br>\n";
var_dump(HTTPRequest::getParameter('one', '1', '/\\d+/'));
var_dump(HTTPRequest::getParameter(array('one', 'two'), '1', '/\\d+/'));
echo "============================================================== <br>\n";
var_dump(HTTPRequest::getContext('one'), $_REQUEST);
var_dump(HTTPRequest::setContext(array('two' => 2)), $_REQUEST);
echo "============================================================== <br>\n";