本文整理汇总了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' => ''));
}
示例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));
}