Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
<?php | |
public function rules() | |
{ | |
return array( | |
array( | |
'end_time', | |
'compare', | |
'compareAttribute'=>'start_time', | |
'operator'=>'>', | |
'on'=>'insert', |
<?php | |
public function actionImport() | |
{ | |
$message = ''; | |
if (!empty($_POST)) | |
{ | |
$file = CUploadedFile::getInstanceByName('import'); | |
$spec = Yii::app()->basePath.'/data/imports/'.$file->name; | |
$file->saveAs($spec); | |
spl_autoload_unregister(array('YiiBase','autoload')); |
<?php | |
/** | |
* A class for true random hash string generation. | |
*/ | |
class RandHash | |
{ | |
/** | |
* @param string $prefix to be used with uniqid() | |
* @return string hash | |
*/ |
<?php | |
/** | |
* Checks to see if the user IP is allowed by {@link ipFilters}. | |
* @param string $ip the user IP | |
* @return boolean whether the user IP is allowed by {@link ipFilters}. | |
*/ | |
protected function allowIp($ip) | |
{ | |
foreach ($this->ipFilters as $filter) | |
{ |
<?php | |
public function actionBatchUpdate($id) | |
{ | |
$model = Product::model()->findByPk($id); | |
$items=Retailprice::model()->findAllByAttributes(array('product_id'=>$id)); | |
if(isset($_POST['Retailprice'])) | |
{ | |
$valid=true; |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
~键盘输入 | |
Ctrl+T:将光标所在处的字符和光标前一字符对调,T,可以理解为Transfer。 | |
Alt+T:交换两个光标当前所处位置单词和光标前一个单词。 | |
Ctrl+U:从光标所在处开始删除字符,直到行首;u,可以理解为undo光标前所有输入。 | |
Ctrl+Y:恢复Ctrl+U删除的字符;y,可以理解为vim里的yank(复制)。 | |
Ctrl+?:删除所有字符,比Ctrl+U强。 | |
Ctrl+K:从光标所在处开始删除字符,直到行尾。 | |
Ctrl+W:删除最后一个单词;W,Word。 |
<?php | |
/** | |
* @property int $bit_id | |
*/ | |
class Thing extends CActiveRecord { | |
} | |
/** | |
* @property int $id |
<?php | |
/** | |
* FlashBehavior class file. | |
*/ | |
class FlashBehavior extends CActiveRecordBehavior | |
{ | |
/** | |
* @var string key identifying the flash message | |
*/ | |
public $key = 'success'; |
<?php | |
#ref: http://www.yiiframework.com/forum/index.php/topic/15298-how-can-i-get-random-values-from-model/page__view__findpost__p__76052 | |
$max = Table::model()->count(array( | |
'condition' => 'status<:status', | |
'params' => array('status' => Table::STATUS_A) | |
)); | |
$offset = rand(0,$max); |