getInt() 공개 정적인 메소드

获取get int数据
public static getInt ( string $name, null $default = null ) : integer | null
$name string 要获取的变量
$default null 未获取到$_GET值时返回的默认值
리턴 integer | null
예제 #1
0
파일: Page.php 프로젝트: zonquan/cmlphp
 /**
  * 构造函数
  *
  * @param int $totalRows 总行数
  * @param int $listRows 每页显示条数
  * @param string $param分页跳转时带的参数
  *
  * @return void
  */
 public function __construct($totalRows, $listRows = 20, $param = '')
 {
     $this->totalRows = $totalRows;
     $this->listRows = $listRows ? intval($listRows) : 10;
     $this->varPage = Config::get('VAR_PAGE') ? Config::get('VAR_PAGE') : 'p';
     $this->param = $param;
     $this->totalPages = ceil($this->totalRows / $this->listRows);
     $this->coolPages = ceil($this->totalPages / $this->rollPage);
     $this->nowPage = Input::getInt($this->varPage, 2);
     if ($this->nowPage < 1) {
         $this->nowPage = 1;
     } elseif (!empty($this->totalRows) && $this->nowPage > $this->totalPages) {
         $this->nowPage = $this->totalPages;
     }
     $this->firstRow = $this->listRows * ($this->nowPage - 1);
 }
예제 #2
0
파일: Page.php 프로젝트: linhecheng/cmlphp
 /**
  * 构造函数
  *
  * @param int $totalRows 总行数
  * @param int $numPerPage 每页显示条数
  * @param array $param 分页跳转时带的参数 如:['name' => '张三']
  */
 public function __construct($totalRows, $numPerPage = 20, $param = [])
 {
     $this->totalRows = $totalRows;
     $this->numPerPage = $numPerPage ? intval($numPerPage) : 10;
     $this->pageShowVarName = Config::get('var_page') ? Config::get('var_page') : 'p';
     $this->param = $param;
     $this->totalPages = ceil($this->totalRows / $this->numPerPage);
     $this->coolPages = ceil($this->totalPages / $this->barShowPage);
     $this->nowPage = Input::getInt($this->pageShowVarName, 1);
     if ($this->nowPage < 1) {
         $this->nowPage = 1;
     } elseif (!empty($this->totalRows) && $this->nowPage > $this->totalPages) {
         $this->nowPage = $this->totalPages;
     }
     $this->firstRow = $this->numPerPage * ($this->nowPage - 1);
 }