本文整理汇总了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";