本文整理汇总了PHP中HTTPRequest::setContext方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::setContext方法的具体用法?PHP HTTPRequest::setContext怎么用?PHP HTTPRequest::setContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::setContext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore
function restore($id)
{
if (!Session::$active || !preg_match('/^\\w+$/', $id) || !Session::isParameter("restore_{$id}")) {
return false;
}
return HTTPRequest::setContext(unserialize(Session::getParameter("restore_{$id}")));
}
示例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";