本文整理匯總了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;
}