当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTimeHelper::convertToDTStringFromPOSTForFieldName方法代码示例

本文整理汇总了PHP中DateTimeHelper::convertToDTStringFromPOSTForFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeHelper::convertToDTStringFromPOSTForFieldName方法的具体用法?PHP DateTimeHelper::convertToDTStringFromPOSTForFieldName怎么用?PHP DateTimeHelper::convertToDTStringFromPOSTForFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeHelper的用法示例。


在下文中一共展示了DateTimeHelper::convertToDTStringFromPOSTForFieldName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionRegister

 public function actionRegister()
 {
     $model = new User('register');
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['User'])) {
         $model->setAttributes($_POST['User']);
         $model->birthday = DateTimeHelper::convertToDTStringFromPOSTForFieldName('birthday', $_POST);
         //captcha validating
         require_once Yii::app()->basePath . '/vendor/recaptchalib.php';
         $privatekey = "6LfXBe8SAAAAAA7fOOWIfyfmvWbIjk-s15UFfGec";
         $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         if (!$resp->is_valid) {
             $error = $resp->error;
             if ($resp->error == 'incorrect-captcha-sol') {
                 $error = '確認碼不正確';
             }
             $this->render('register', array('model' => $model, 'captchaError' => $error));
             return;
         } else {
             // Your code here to handle a successful verification
             /** store the password for the athentication user
              *  Since the password will be hashed once it is saved
              */
             $rawPassword = $model->password;
             if ($model->validate()) {
                 if ($model->save()) {
                     $identity = new UserIdentity($model->user_name, $rawPassword);
                     $duration = 3600 * 24 * 30;
                     // 30 days
                     $identity->authenticate();
                     if (Yii::app()->user->login($identity, $duration)) {
                         Yii::app()->user->setFlash(FlashMsg::SUCCESS, "歡迎加入!");
                     } else {
                         Yii::app()->user->setFlash(FlashMsg::WARNING, "歡迎加入! 請在登入頁面登入");
                     }
                     $this->redirect(array('index'));
                 } else {
                     Yii::app()->user->setFlash(FlashMsg::ERROR, "創建使用者失敗");
                 }
             } else {
                 $model->purgePassword();
             }
         }
     }
     $this->render('register', array('model' => $model, 'captchaError' => ''));
 }
开发者ID:kittolau,项目名称:gcm,代码行数:47,代码来源:SiteController.php

示例2: actionUpdateUser

 public function actionUpdateUser()
 {
     $model = User::model()->findByPk(Yii::app()->user->id);
     $fileModel = new FileUploadFormModel();
     $fileModel->setScenario(FileUploadFormModel::FILE_UPLOAD_MODE_SINGLE);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['User'])) {
         $model->setScenario('update');
         $model->setAttributes($_POST['User']);
         $model->birthday = DateTimeHelper::convertToDTStringFromPOSTForFieldName('birthday', $_POST);
         $test = $model->summary;
         if ($model->validate()) {
             $fileModel->LoadUploadedeImage();
             if ($fileModel->isUploadedFile()) {
                 if ($fileModel->validate()) {
                     $SavedFileRelativePaths = $fileModel->processImage(get_class($model), $model->user_name, md5(DateTimeHelper::now()));
                     $model->icon_src = ArrayHelper::array2string($SavedFileRelativePaths);
                     if ($model->save()) {
                         Yii::app()->user->setFlash(FlashMsg::SUCCESS, "個人資料已更新");
                         $this->redirect(array('index'));
                     } else {
                         Yii::app()->user->setFlash(FlashMsg::ERROR, "更新個人資料失敗");
                     }
                 } else {
                     $this->render('updateUser', array('model' => $model, 'fileModel' => $fileModel));
                 }
             }
             if ($model->save()) {
                 Yii::app()->user->setFlash(FlashMsg::SUCCESS, "個人資料已更新");
                 $this->redirect(array('index'));
             }
         }
     }
     $this->render('updateUser', array('model' => $model, 'fileModel' => $fileModel));
 }
开发者ID:kittolau,项目名称:gcm,代码行数:36,代码来源:MemberCenterController.php


注:本文中的DateTimeHelper::convertToDTStringFromPOSTForFieldName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。