📜  分页总是显示 5 页 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:47.596000             🧑  作者: Mango

代码示例1
function pageRange(page,pageCount){

var start = page-2,
    end = page+2;

if(end>pageCount){
    start-=(end-pageCount);
    end=pageCount;
}
if(start<=0){
    end+=((start-1)*(-1));
    start=1;
}

end = end>pageCount?pageCount:end;

return {start:start, end:end};
}