楼上括号中的内容
// get start
if($page > $page_offset){$start = $page - $page_offset;}
// get end
if($page + $page_offset < $total_pages){$end = $page + $page_offset;}
// revise end
if(1 == $start){$end = $show_page;}
// revise start
if($total_pages == $end){$start = $total_pages - $show_page + 1;}
// get start
if($page > $page_offset){$start = $page - $page_offset;}
// get end
if($page + $page_offset < $total_pages){$end = $page + $page_offset;}
// revise end
if(1 == $start){$end = $show_page;}
// revise start
if($total_pages == $end){$start = $total_pages - $show_page + 1;}
分页代码有点麻烦!而且不易理解!只能输入300个字符,贴不上来!
分开贴试试:
$start = 1;
$end = $total_pages;
if($total_pages > $show_page)
{
在楼下贴出来
}
if($start > 1){$page_bar .="...";}
for($i = $start; $i <= $end; $i ++){$page_bar .= "<a href=".$_SERVER['PHP_SELF']."?p=".$i."'>$i</a>";}
if($end < $total_pages){$page_bar .="...";}
分开贴试试:
$start = 1;
$end = $total_pages;
if($total_pages > $show_page)
{
在楼下贴出来
}
if($start > 1){$page_bar .="...";}
for($i = $start; $i <= $end; $i ++){$page_bar .= "<a href=".$_SERVER['PHP_SELF']."?p=".$i."'>$i</a>";}
if($end < $total_pages){$page_bar .="...";}
讲师回答 / BobWang
同学你好,你自学的html css js mysql linux这些知识刚好是一个合格的php开发人员所必备的,所以不用没有用的,你现在所需要的就是选择一门语言,然后用心的学下去,杂念太多反而不好,php市场也还是很热的
2015-06-16