當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。