2011年8月28日 星期日
Increase MySQL max_allowed_packet
查看目前的max_allowed_packet:
SHOW VARIABLES LIKE 'max_allowed_packet'
在my.ini[mysqld]下
加上max_allowed_packet = 128M
重啟MySQL
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_max_allowed_packet
http://drupal.org/node/379976
2011年8月23日 星期二
Datepicker 設定日期選擇範圍
$(function() {
$(".timepicker").timePicker();
$(".datepicker").datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
beforeShow: customRange
});
});
function customRange(input) //設定datepicker的日期範圍
{
return {
minDate: (input.id == "pre_statistic_end_date" ? $("#pre_statistic_start_date").datepicker("getDate") : null),
maxDate: (input.id == "pre_statistic_start_date" ? $("#pre_statistic_end_date").datepicker("getDate") : null)
};
}
http://stackoverflow.com/questions/330737/jquery-datepicker-2-inputs-textboxes-and-restricting-range
$(".timepicker").timePicker();
$(".datepicker").datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
beforeShow: customRange
});
});
function customRange(input) //設定datepicker的日期範圍
{
return {
minDate: (input.id == "pre_statistic_end_date" ? $("#pre_statistic_start_date").datepicker("getDate") : null),
maxDate: (input.id == "pre_statistic_start_date" ? $("#pre_statistic_end_date").datepicker("getDate") : null)
};
}
http://stackoverflow.com/questions/330737/jquery-datepicker-2-inputs-textboxes-and-restricting-range
2011年6月21日 星期二
php群組函數array_filter妙用-刪除空白傎
定義和用法
array_filter() 函數用回調函數過濾數組中的元素,如果自定義過濾函數返回true,則被操作的數組的當前值就會被包含在返回的結果數組中, 並將結果組成一個新的數組。如果原數組是一個關聯數組,鍵名保持不變。語法
array_filter(array,function)參數描述
array 必需。規定輸入的數組。
function 必需。自定義函數的名稱。
例子
"Dog",1=>"Cat",2=>"Horse"); print_r(array_filter($a,"myfunction")); ?>輸出:Array ( [2] => Horse )
而如果沒有帶回調函數時會怎麼樣?我們下面看例子:
$arr = array( 0 => '火躍',
1 => false,2 => 1,3 => null,4 => ”,6 =>'0′);print_r(array_filter($arr));輸出:Array ( [0] => 火躍[2] => 1 [5] => http://www.huoyue.org )
現在你可能猜到了這個的作用了,就刪除群組中所有相當於false的值!
原文-http://www.huoyue.org/php_array_filter
2011年6月20日 星期一
在不同的地方呼叫UserId
●在action裡
$this->getUser()->getUserId();
●在success裡
$sf_user->getUserId();
●在form裡
sfContext::getInstance()->getUser()->getUserId();
$this->getUser()->getUserId();
●在success裡
$sf_user->getUserId();
●在form裡
sfContext::getInstance()->getUser()->getUserId();
訂閱:
文章 (Atom)