• uat


    protected function getPagesByLists($page, $base_url = null, $current_page=1)
        {
    
            $ret=[];
            $is_search_page = false;
            // $is_search_page = true;
            for($i=1;$i<=$page;++$i)
            {
                switch ($i)
                {
                    case 1 :
                        if($_SERVER["QUERY_STRING"])
                        {
    //                        $sub_str=substr($_SERVER["QUERY_STRING"],strpos($_SERVER["QUERY_STRING"],'&')+1);
                            $sub_str=$_SERVER["QUERY_STRING"];
                            $return_url=U($base_url,array_merge(['page'=>$current_page-1,'um'=>I("get.um")])).'?'.$sub_str;
                            $ret[] = ['url'=> $current_page==1?'#':$return_url,'name'=>'&lt;','is_current'=>0, 'is_disabled' => $current_page==1?1:0];
                        }else{
                            $ret[] = ['url'=> $current_page==1?'#':U($base_url,array_merge(I("get."),['page'=>$current_page-1,'um'=>I("get.um")])),'name'=>'&lt;','is_current'=>0, 'is_disabled' => $current_page==1?1:0];
                        }
    
                    default :
                        if(abs($current_page-$i) < 3)
                        {
                            if($_SERVER["QUERY_STRING"])
                            {
    //                            $sub_str=substr($_SERVER["QUERY_STRING"],strpos($_SERVER["QUERY_STRING"],'&')+1);
                                $sub_str=$_SERVER["QUERY_STRING"];
                                $return_url=U($base_url,array_merge(['page'=> $i,'um'=>I("get.um")])).'?'.$sub_str;
                                $ret[] = ['url'=>$return_url,'name'=>$i,'is_current'=>$current_page==$i?1:0,'is_disabled'=>0];
                            }else{
                                $ret[] = ['url'=>U($base_url,array_merge(I("get."),['page'=> $i,'um'=>I("get.um")])),'name'=>$i,'is_current'=>$current_page==$i?1:0,'is_disabled'=>0];
                            }
    
                        }else{
                            $is_search_page = true;
                        }
                        break;
                }
    
            }
            if($page>0)
            {
                if($_SERVER["QUERY_STRING"])
                {
    //                $sub_str=substr($_SERVER["QUERY_STRING"],strpos($_SERVER["QUERY_STRING"],'&')+1);
                    $sub_str=$_SERVER["QUERY_STRING"];
                    $return_url= U($base_url,array_merge(['page'=> $current_page>=$page?$page:$current_page+1,'um'=>I("get.um")])).'?'.$sub_str;
                    $ret[] = ['url'=>$return_url,'name'=>'&gt;','is_current'=>0];
                }else{
                    $ret[] = ['url'=> U($base_url,array_merge(I("get."),['page'=> $current_page>=$page?$page:$current_page+1,'um'=>I("get.um")])) ,'name'=>'&gt;','is_current'=>0];
                }
    
            }
            if($is_search_page){
                $get_params = I("get.");
                if(isset($get_params['page'])){
                    unset($get_params['page']);
                }
    
                $ret[] = ['is_search_page'=>'1','url'=> U($base_url,array_merge($get_params,['um'=>I("get.um")]),true)];
    
            }
    
            return json_encode($ret);
        }
  • 相关阅读:
    好的学习资源
    对paper有用的idea
    斜杠青年
    简书随笔
    点云专业英文单词
    通过 UDP 发送数据的简单范例
    简单的聊天时范例(客户端)
    键盘输入
    简单的传输文件范例
    编写serversocket简单示例1
  • 原文地址:https://www.cnblogs.com/stj123/p/12372615.html
Copyright © 2020-2023  润新知