這個不是bug,而且warning,當用$_GET[]或$_POST[]時不加isset之類判斷的話,就會提示這個錯誤,Jones建議的解決方案完美解決這個問題:
/*
* 取代$_GET[]獲取值
*/
function _get($str) {
$val = !empty($_GET[$str]) ? $_GET[$str] : null;
return $val;
}
/*
* 取代$_POST[]獲取值
*/
function _post($str) {
$val = !empty($_POST[$str]) ? $_POST[$str] : null;
return $val;
}使用的時候,用法如下:
/** 設置當前頁數 */
$page = _get('page');
$inventory->setCurrentPage($page);
/** 計算總頁數 */
$sku = _post('sku');
$warehouse = _post('warehouse');
$supplier = _post('supplier');