本文整理汇总了PHP中functions::pageInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP functions::pageInfo方法的具体用法?PHP functions::pageInfo怎么用?PHP functions::pageInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions
的用法示例。
在下文中一共展示了functions::pageInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAll
public function getAll($sql, $pageCondition = false)
{
if (is_array($pageCondition)) {
$pageCondition['page'] = ($page = functions::uint($pageCondition['page'])) ? $page : 1;
$pageCondition['pagesize'] = ($pagesize = functions::uint($pageCondition['pagesize'])) ? $pagesize : 20;
$resource = odb::db()->getAll($sql);
$rows = count($resource);
$pageInfo = functions::pageInfo($rows, $pageCondition['pagesize'], $pageCondition['page']);
}
$startRow = ($pageCondition['page'] - 1) * $pageCondition['pagesize'];
$sql = is_array($pageCondition) ? $sql . " LIMIT {$startRow}, {$pageCondition['pagesize']}" : $sql;
$list = odb::db()->getAll($sql, MYSQL_ASSOC);
if (is_array($pageCondition)) {
$response = array('list' => $list, 'pageInfo' => $pageInfo);
return $response;
}
return $list;
}
示例2: findAll
public function findAll($noPrint = true)
{
extract(self::$_rcdata);
$sql = "SELECT {$field} FROM {$table} {$join} {$where} {$order} {$limit}";
if (!$noPrint) {
echo $sql;
exit;
}
self::$_rcdata['lastsql'] = $sql;
$list = $this->getAll($sql, MYSQL_ASSOC);
if (self::$_rcdata['page'] && !empty($list)) {
$sql = "SELECT COUNT(*) AS count FROM {$table} {$join} {$where} {$order}";
$rows = $this->getOne($sql, MYSQL_ASSOC);
$rows = $rows['count'];
$list = array('aList' => $list, 'pageInfo' => functions::pageInfo($rows, self::$_rcdata['limit_get']['pagesize'], self::$_rcdata['limit_get']['page']));
}
$this->__freeMemory();
return $list;
}