當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GUMP::set_i8n方法代碼示例

本文整理匯總了PHP中GUMP::set_i8n方法的典型用法代碼示例。如果您正苦於以下問題:PHP GUMP::set_i8n方法的具體用法?PHP GUMP::set_i8n怎麽用?PHP GUMP::set_i8n使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在GUMP的用法示例。


在下文中一共展示了GUMP::set_i8n方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GUMP

#!/usr/bin/php -q
<?php 
require "../gump.class.php";
$validator = new GUMP();
$validator->set_i8n(array('mismatch' => 'There is no validation rule for {field}', 'validate_required' => 'The {field} field is required', 'validate_valid_email' => 'The {field} field is required to be a valid email address', 'validate_max_len' => 'The {field} field needs to be {params} or shorter in length', 'validate_min_len' => 'The {field} field needs to be {params} or longer in length', 'validate_exact_len' => 'The {field} field needs to be exactly {params} characters in length', 'validate_alpha' => 'The {field} field may only contain alpha characters(a-z)', 'validate_alpha_numeric' => 'The {field} field may only contain alpha-numeric characters', 'validate_alpha_dash' => 'The {field} field may only contain alpha characters &amp; dashes', 'validate_numeric' => 'The {field} field may only contain numeric characters', 'validate_integer' => 'The {field} field may only contain a numeric value', 'validate_boolean' => 'The {field} field may only contain a true or false value', 'validate_float' => 'The {field} field may only contain a float value', 'validate_valid_url' => 'The {field} field is required to be a valid URL', 'validate_url_exists' => 'The {field} URL does not exist', 'validate_valid_ip' => 'The {field} field needs to contain a valid IP address', 'validate_valid_cc' => 'The {field} field needs to contain a valid credit card number', 'validate_valid_name' => 'The {field} field needs to contain a valid human name', 'validate_contains' => 'El campo {field} solo debe contener los siguientes valores : {params}', 'validate_street_address' => 'The {field} field needs to be a valid street address', 'validate_date' => 'The {field} field needs to be a valid date', 'validate_min_numeric' => 'The {field} field needs to be a numeric value, equal to, or higher than {params}', 'validate_max_numeric' => 'The {field} field needs to be a numeric value, equal to, or lower than {params}', 'validate_min_age' => 'The {field} field needs to have an age greater than or equal to {params}', 'default' => 'The {field} field is invalid'));
$rules = array('account_type' => "required|contains,pro free basic premium", 'priority' => "required|contains,'low' 'medium' 'very high'");
echo "\nVALID DATA TEST:\n\n";
// Valid Data
$_POST_VALID = array('account_type' => 'pro', 'priority' => 'very high');
$valid = $validator->validate($_POST_VALID, $rules);
if ($valid !== true) {
    echo $validator->get_readable_errors(true);
} else {
    echo "Validation passed! \n";
}
echo "\nINVALID DATA TEST:\n\n";
// Invalid
$_POST_INVALID = array('account_type' => 'bad', 'priority' => 'unknown');
$invalid = $validator->validate($_POST_INVALID, $rules);
if ($invalid !== true) {
    echo $validator->get_readable_errors(true);
    echo "\n\n";
} else {
    echo "Validation passed!\n\n";
}
開發者ID:aecca,項目名稱:GUMP,代碼行數:25,代碼來源:contains.php


注:本文中的GUMP::set_i8n方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。