本文整理匯總了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);