本文整理汇总了PHP中validator::required方法的典型用法代码示例。如果您正苦于以下问题:PHP validator::required方法的具体用法?PHP validator::required怎么用?PHP validator::required使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator
的用法示例。
在下文中一共展示了validator::required方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forms
require_once $current_dir . "/install/validator.php";
$country_list = (require_once $current_dir . "/protected/components/CountryCode.php");
$forms = new forms();
$currency_list = array('AUD' => "AUD-$", 'CAD' => "CAD-$", 'CNY' => "CNY-¥", 'EUR' => "EUR-€", 'HKD' => "HKD-$", 'JPY' => "JPY-¥", 'MXN' => "MXN-$", 'USD' => "USD-$", 'NZD' => "NZD-$");
$currency_list = array_flip($currency_list);
?>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
?>
<?php
$err = '';
$data = $_POST;
$req = array('website_title' => "Website title is required", 'admin_country_set' => "Country is required", 'website_address' => "Address is required", 'website_contact_phone' => "Phone is required", 'website_contact_email' => "Email is required", 'admin_currency_set' => "Currency is required", 'username' => "Username is required", 'password' => "Password is required");
$validator = new validator();
$validator->required($req, $data);
if ($validator->validate()) {
$admin_currency_set = explode("-", $data['admin_currency_set']);
$db_con = $_SESSION['kr_install_data'];
$table_prefix = isset($db_con['db_table_prefix']) ? $db_con['db_table_prefix'] : '';
$table_prefix = !empty($table_prefix) ? $table_prefix : "mt_";
require_once $current_dir . "/protected/config/table_structure.php";
require_once $current_dir . "/install/class.MySQL.php";
echo "<p class=\"uk-icon-chevron-right\"> Connecting to database..</p>";
//$db = new Db( 'mysql', $db_con['db_host'], $db_con['db_name'], $db_con['db_username'],$db_con['db_pass'] );
$db = new MySQL($db_con['db_name'], $db_con['db_username'], $db_con['db_pass'], $db_con['db_host']);
echo "<div>Connection [ok]</div>";
echo "<p class=\"uk-icon-chevron-right\"> Saving information ...</p>";
$params = array('website_title' => $data['website_title'], 'admin_country_set' => $data['admin_country_set'], 'website_address' => $data['website_address'], 'website_contact_phone' => $data['website_contact_phone'], 'website_contact_email' => $data['website_contact_email'], 'admin_currency_set' => $admin_currency_set[0]);
$truncate = "TRUNCATE TABLE " . $table_prefix . "option";
$db->raw($truncate);