本文整理汇总了PHP中HTTPRequest::isParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::isParameter方法的具体用法?PHP HTTPRequest::isParameter怎么用?PHP HTTPRequest::isParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::isParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __apply
function __apply($extra)
{
$messages = array();
if (!HTTPRequest::isParameter('numero', '/^\\d+$/')) {
$messages['numero'] = 'El valor no es valido';
}
$letra = HTTPRequest::getParameter('letra', '');
if ($letra && !preg_match('/^[A-Za-z]+$/', $letra)) {
$messages['letra'] = 'El campo incluir puras letras';
}
if (count($messages) > 0) {
return $messages;
}
echo "Ejecutar operacion en la BD<br>";
return true;
}
示例2: file_put_contents
<?php
include '../../lib.php';
$lend = HTTPRequest::getParameter('lend');
$session = HTTPRequest::getParameter('session');
//$path_app = $parameters->getParameter('path_app');
//$path_temp = $parameters->getParameter('path_temp');
$path_app = '';
$path_temp = 'temp/';
$log = "{$path_temp}lender.log";
if (!$lend || !$session) {
file_put_contents($log, "[" . date('Y-m-d H:i:s') . "] Solicitud incorrecta\n", FILE_APPEND);
return null;
}
if (!HTTPRequest::isParameter('token')) {
// solicitud de procesamiento
if (!file_exists("{$path_app}app.{$lend}")) {
file_put_contents($log, "[" . date('Y-m-d H:i:s') . "] [{$lend}] [{$session}] Solicitud de {$lend} denegada\n", FILE_APPEND);
return null;
}
$token = $lend . time();
$i = 0;
while (file_exists("{$path_temp}" . md5($token . "_" . $i)) && $i < 50) {
$i++;
}
if ($i >= 50) {
file_put_contents($log, "[" . date('Y-m-d H:i:s') . "] [{$lend}] [{$session}] Maximo de solicitudes permitidas para {$lend}. Ha sido denegada\n", FILE_APPEND);
return null;
}
$token = md5($token . "_" . $i);
file_put_contents("{$path_temp}token.{$session}", $lend . "\n" . $token . "\n");
示例3: 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";