本文整理汇总了PHP中fRequest::set方法的典型用法代码示例。如果您正苦于以下问题:PHP fRequest::set方法的具体用法?PHP fRequest::set怎么用?PHP fRequest::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fRequest
的用法示例。
在下文中一共展示了fRequest::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetArrayOverrideScalar
public function testSetArrayOverrideScalar()
{
$_GET = array('user' => array('name' => 'John Smith', 'email' => 'john@smith.com'));
fRequest::set('user[name][first]', 'John');
$this->assertEquals(array('user' => array('name' => array('first' => 'John'), 'email' => 'john@smith.com')), $_GET);
}
示例2: str_replace
<?php
$page = 'addcard';
require 'header.php';
if ($user) {
fSession::destroy();
fURL::redirect();
}
if (isset($_POST['submit'])) {
try {
fRequest::validateCSRFToken($_POST['token']);
// Strip colons from uid (easier to copy paste from some NFC
// reader apps).
fRequest::set('uid', str_replace(':', '', fRequest::get('uid')));
$validator = new fValidation();
$validator->addRequiredFields('password', 'email', 'uid');
$validator->addEmailFields('email');
$validator->addRegexRule('uid', '#^[0-9a-fA-F]+$#', 'Not in hex format');
$validator->validate();
$uid = strtoupper($_POST['uid']);
if ($uid == '21222324') {
/* New Visa cards return this, presumably for privacy */
throw new fValidationException('Non-unique UID. This card cannot be added to the system.');
}
// Random IDs are 4 bytes long and start with 0x08
// http://www.nxp.com/documents/application_note/AN10927.pdf
if (strlen($uid) === 8 && substr($uid, 0, 2) === "08") {
throw new fValidationException('ID is randomly generated and will change every time the card is used!');
}
if (strlen($uid) === 8 && substr($uid, 0, 2) === "88") {
throw new fValidationException('Card UID\'s can\'t start with 88');