本文整理汇总了PHP中ezcInputForm::getUnsafeRawData方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm::getUnsafeRawData方法的具体用法?PHP ezcInputForm::getUnsafeRawData怎么用?PHP ezcInputForm::getUnsafeRawData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcInputForm
的用法示例。
在下文中一共展示了ezcInputForm::getUnsafeRawData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
$def = array('test1' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'string', FILTER_FLAG_STRIP_HIGH), 'test2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 42)), 'test3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int', array('min_range' => 42)));
$form = new ezcInputForm(INPUT_POST, $def);
echo "Valid properties:\n";
var_dump($form->getValidProperties());
echo "Invalid properties:\n";
var_dump($form->getInvalidProperties());
echo "Required properties:\n";
var_dump($form->getRequiredProperties());
echo "Optional properties:\n";
var_dump($form->getOptionalProperties());
echo "Values:\n";
var_dump($form->hasValidData('test1'));
var_dump($form->test1);
try {
var_dump($form->getUnsafeRawData('test1'));
} catch (ezcInputFormException $e) {
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
echo "<hr/>\n";
var_dump($form->hasValidData('test2'));
try {
var_dump($form->test2);
} catch (ezcInputFormException $e) {
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
try {
var_dump($form->getUnsafeRawData('test2'));
} catch (ezcInputFormException $e) {
echo $e->getCode(), ': ', $e->getMessage(), "\n";
}
示例2: ezcInputForm
<?php
if (ezcInputForm::hasGetData()) {
$form = new ezcInputForm(INPUT_GET, $definition);
foreach ($definition as $name => $dummy) {
$propertyName = "property_{$name}";
$propertyWarningName = "warning_{$name}";
if ($form->hasValidData($name)) {
${$propertyName} = $form->{$name};
} else {
${$propertyName} = htmlspecialchars($form->getUnsafeRawData($name));
${$propertyWarningName} = '[invalid]';
}
}
}
示例3: testGetUnsafeRawDataNoDataField
public function testGetUnsafeRawDataNoDataField()
{
$def = array('test2' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'), 'test3' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::OPTIONAL, 'int'));
try {
$obj = new ezcInputForm(INPUT_GET, $def);
$obj->getUnsafeRawData('test2');
self::fail("No exception, where we should have had one");
} catch (ezcInputFormFieldNotFoundException $e) {
self::assertEquals("The field 'test2' could not be found in the input source.", $e->getMessage());
}
}