本文整理汇总了PHP中Store::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::validate方法的具体用法?PHP Store::validate怎么用?PHP Store::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new Store();
if ($_POST['Store']) {
$accessKey = Yii::app()->params['qiniu']['accessKey'];
$secretKey = Yii::app()->params['qiniu']['secretKey'];
$auth = new Auth($accessKey, $secretKey);
$bucket = 'urtime1';
$token = $auth->uploadToken($bucket);
$uploadMgr = new UploadManager();
//上传logo
if ($_FILES['image']['name'] != null) {
$images = array($_FILES['image']);
$images = $this->setImageInformation($images, $token, $uploadMgr);
if ($images) {
$_POST['Store']['image'] = $images[0];
}
unset($_FILES['image']);
}
//上传营业执照
if ($_FILES['bussiness_license1']['name'] != null || $_FILES['bussiness_license2']['name'] != null) {
$images = array($_FILES['bussiness_license1'], $_FILES['bussiness_license2']);
$images = $this->setImageInformation($images, $token, $uploadMgr);
if ($images) {
// $images_str = implode(',',$images);
$_POST['Store']['bussiness_license'] = json_encode($images);
//$images_str;
}
unset($_FILES['bussiness_license1']);
unset($_FILES['bussiness_license2']);
}
//上传介绍图片
if ($_FILES['upImage']['name'] != null) {
$images = $this->setImageInformation($_FILES, $token, $uploadMgr);
if ($images) {
//$images_str = implode(',',$images);
$_POST['Store']['images_str'] = json_encode($images);
//$images_str;
}
}
$model->attributes = $_POST['Store'];
if ($model->validate() && $model->save()) {
//$this->redirect('site/index');
Yii::app()->user->setFlash('create', '成功', '失败');
// Yii::app()->end();
$this->redirect(array('/store/view'));
}
}
$managers = Managers::model()->loadStaffAllModel();
$this->render('create', ['model' => $model, 'managers' => $managers]);
}
示例2: actionCreateStore
public function actionCreateStore()
{
$model = new Store();
if (isset($_POST['Store'])) {
// print_r($_POST);
// print_r($model->attributes);
// exit;
$model->attributes = $_POST['Store'];
$model->domain = 'shop' . time() . '.' . F::sg('site', 'shopDomain');
$model->theme = 'default';
if ($model->validate()) {
if ($model->save()) {
$this->redirect('http://' . $model->domain);
}
} else {
print_r($model->errors);
}
}
}
示例3: import
//.........这里部分代码省略.........
}
if ($this->isMobile($phone2)) {
$StoreView['mobile'] = $phone2;
$StoreView['phone'] = $phone1;
}
} else {
if ($phone1) {
if ($this->isMobile($phone1)) {
$StoreView['mobile'] = $phone1;
} else {
$StoreView['phone'] = $phone1;
}
} else {
if ($phone2) {
if ($this->isMobile($phone2)) {
$StoreView['mobile'] = $phone2;
} else {
$StoreView['phone'] = $phone2;
}
}
}
}
// end phone and mobile
// email
$StoreView->email = $data['CCR_Email'];
if (!is_null($StoreView->email)) {
$StoreView->email = rtrim(mcrypt_decrypt($this->cipher, $this->key1, base64_decode($StoreView['email']), $this->mode, $this->iv));
}
if (!is_null($StoreView['email']) && !filter_var($StoreView->email, FILTER_VALIDATE_EMAIL)) {
$StoreView->email = null;
}
// end email
// Save the contact in the store
if (!$StoreView->validate()) {
print '$StoreView->errors:' . "\n";
print_r($StoreView->errors);
} else {
$this->totalImported++;
//in dupe set
$data['CCR_Ind_Set'] = (int) trim($data['CCR_Ind_Set']);
/*
if(this row has (int)CCR_Ind_Set > 0){
select existing 1+ duplicates
if(this row (int)CCR_Ind_Set matches a ccr_duplicate_id with the same organisation_id){
// mega dupe
if( existing record has 'Yes' for CCR_Ind_Dupe1 ){
insert and expire this row
}
else
{
expire existing
insert this row
}
}
else
{
// no other rows in same org
insert this row
}
}
else
{