本文整理匯總了PHP中Paging::_page_siez方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paging::_page_siez方法的具體用法?PHP Paging::_page_siez怎麽用?PHP Paging::_page_siez使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Paging
的用法示例。
在下文中一共展示了Paging::_page_siez方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getData
public static function getData($tableName, $page = 1, $page_size = 0, $where = null, $order = null, $select = null)
{
if (!$tableName) {
return false;
}
$total = self::getCounts($tableName, $where);
if (!$page_size) {
$page_size = 30;
}
$total_page = ceil($total / $page_size);
if ($page < 1) {
$page = 1;
}
if ($page > $total_page) {
$page = $total_page;
}
if ($page < 1) {
$page = 1;
}
self::$_page = $page;
self::$_page_siez = $page_size;
self::$_total_page = $total_page;
$count = ($page - 1) * $page_size;
if (!$where) {
$where = "id>0";
}
if (!$order) {
$order = " ORDER BY id DESC";
} else {
$order = " ORDER BY " . $order;
}
if (!$select) {
$select = '*';
}
$options['condition'] = $where;
$options['offset'] = $count;
$options['size'] = $page_size;
$options['order'] = $order;
$options['select'] = $select;
//DB::Debug();
$data = DB::LimitQuery($tableName, $options);
self::$_data = $data;
return $data;
}