This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class User extends CActiveRecord | |
{ | |
public $password2; | |
... | |
public function rules() | |
{ | |
return array( | |
... | |
array('password', 'compare', 'compareAttribute'=>'password2', 'message'=>'{attribute} とパスワード(確認)が一致しません。', 'on'=>'register'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
Yii::createWebApplication($config)->run(); | |
echo Yii::getLogger()->getExecutionTime(); // 追加 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LoginForm extends CFormModel | |
{ | |
... | |
/** | |
* アクション名を返すメソッド | |
*/ | |
public function getActionId() | |
{ | |
return Yii::app()->controller->action->id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($i = 0; $i < 10000; $i++) | |
echo $model->actionId; | |
// or echo $model->getActionId(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WebUser extends CWebUser | |
{ | |
protected function afterLogin($fromCookie) | |
{ | |
$model = User::model()->findByPk(Yii::app()->user->id); | |
$model->last_ip = Yii::app()->request->userHostAddress; | |
$model->last_login = new CDbExpression('NOW()'); | |
$model->save(true, array('last_ip', 'last_login')); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
'components' => array( | |
'user' => array( | |
'class' => 'WebUser', // この行を書かない場合は、デフォルトのCWebUserが使われる | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webroot/ | |
... | |
images/ | |
empty.jpg | |
tmp/ | |
thumb/ | |
hoge/ | |
thumb/ | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'import' => array( | |
... | |
'application.helpers.*', | |
), | |
'modules' => array( | |
... | |
), | |
'components' => array( | |
'file' => array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ImageUploadBehavior class file. | |
*/ | |
class ImageUploadBehavior extends CActiveRecordBehavior | |
{ | |
/** | |
* @var string the file upload column name | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Item class file. | |
*/ | |
class Item extends CActiveRecord | |
{ | |
... | |
/** | |
* @see CModel::rules() |