当前位置: 首页>>代码示例>>PHP>>正文


PHP ezcInputForm::getUnsafeRawData方法代码示例

本文整理汇总了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";
    }
开发者ID:bmdevel,项目名称:ezc,代码行数:31,代码来源:test4.php

示例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]';
        }
    }
}
开发者ID:bmdevel,项目名称:ezc,代码行数:15,代码来源:tutorial_example_01_process.php

示例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());
     }
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:11,代码来源:tools_test.php


注:本文中的ezcInputForm::getUnsafeRawData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。