本文整理汇总了PHP中Paging::_total_page方法的典型用法代码示例。如果您正苦于以下问题:PHP Paging::_total_page方法的具体用法?PHP Paging::_total_page怎么用?PHP Paging::_total_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paging
的用法示例。
在下文中一共展示了Paging::_total_page方法的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;
}