本文整理汇总了PHP中Paginator::set_parameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::set_parameters方法的具体用法?PHP Paginator::set_parameters怎么用?PHP Paginator::set_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paginator
的用法示例。
在下文中一共展示了Paginator::set_parameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_data
public function get_data()
{
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if (!empty($this->data["tableName"])) {
$query = "SHOW TABLES FROM " . DB_NAME;
$result = $mysqli->query($query);
while ($row = $result->fetch_row()) {
if (empty($this->tableName)) {
if ($row[0] == $this->data["tableName"]) {
$this->tableName = $row[0];
}
}
}
$result->free();
if (empty($this->tableName)) {
$this->tableName = TABLENAME;
}
}
if (!empty($this->data["selectors"]) or !empty($this->data["sorter"])) {
$query = "SHOW COLUMNS FROM " . $this->tableName;
$result = $mysqli->query($query);
while ($row = $result->fetch_assoc()) {
if (!empty($this->data['selectors'])) {
foreach ($this->data["selectors"] as $key->{$value}) {
if (empty($this->selectors[$key])) {
if ($row["Field"] == $key) {
$this->selectors[$key] = $value;
}
}
}
}
if (empty($this->sorter)) {
if ($row["Field"] == $this->data["sorter"]) {
$this->sorter = $row["Field"];
}
}
}
$result->free();
if (empty($this->sorter)) {
$this->sorter = SORTER;
}
}
$mysqli->close();
$this->currentPage = is_numeric($this->data["currentPage"]) && $this->data["currentPage"] >= 1 ? $this->data["currentPage"] : CURRENTPAGE;
$this->pcsPerPage = is_numeric($this->data["pcsPerPage"]) && $this->data["pcsPerPage"] >= 1 ? $this->data["pcsPerPage"] : PCSPERPAGE;
$this->shownPages = is_numeric($this->data["shownPages"]) && $this->data["shownPages"] >= 1 ? $this->data["shownPages"] : SHOWNPAGES;
$this->ascending = is_bool($this->data["ascending"]) ? $this->data["ascending"] : ASCENDING;
$pager = new Paginator();
echo "1" . !$this->data["ascending"];
// echo($this->tableName.$this->currentPage.$this->sorter."'".$this->ascending."'".$this->pcsPerPage.$this->shownPages);
$result = $pager->set_parameters($this->tableName, $this->currentPage, $this->sorter, $this->ascending, $this->pcsPerPage, $this->shownPages, $this->selectors);
return $result;
}
示例2: Paginator
<?php
include "pager.php";
$a = new Paginator();
$b = $a->set_parameters();
$c = $b['pager'];
$d = $b['content'];
for ($i = 0; $i < count($c); $i++) {
echo $c[$i] . "|";
}