$this->uri->segment(3) 在codeigniter分页中有什么用 [英] what is the use of $this->uri->segment(3) in codeigniter pagination

查看:26
本文介绍了$this->uri->segment(3) 在codeigniter分页中有什么用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

听说是我的代码

公共函数viewdeletedrecords(){if($this->session->userdata('applicant_firstname') == ''){重定向('申请人/登录');}$profile = $this->m_applicant->showdeletedrecods('','');$total_rows = count($profile) ;$config['base_url'] = base_url().'index.php/papplicant/viewdeletedrecords/' ;$config['per_page'] = '10' ;$config['full_tag_open'] = '

';$config['full_tag_close'] = '

';$config['first_link'] = 'First' ;$config['last_link'] = 'Last' ;$config['use_page_numbers'] = TRUE ;$config['prev_link'] = '<';$config['uri_segment'] = 3 ;$config['num_links'] = 10 ;$config['cur_tag_open'] = '';$config['cur_tag_close'] = '</b>';$config['total_rows'] = $total_rows ;$invoicepaginate = $this->m_applicant->showdeletedrecods( $config['per_page'], $this->uri->segment(3)) ;$this->分页->初始化($config);$data4 = 数组('数据' =>$invoicepaginate);$this->load->view('申请人', $data4);}

codeigniter中$this->uri->segment(3)的作用是什么

当我输入 $this->uri->segment(3); 它按预期工作,但是当我输入 $this->uri->segment(4); 它停止工作

解决方案

这使您可以从 URI 字符串中检索信息

$this->uri->segment(n);//n=1 控制器,n=2 方法,等等

考虑这个例子:

<块引用>

http://example.com/index.php/controller/action/1stsegment/2ndsegment

它会返回

$this->uri->segment(1);//控制器$this->uri->segment(2);//行动$this->uri->segment(3);//第一段$this->uri->segment(4);//第二段

hear is my code

public function viewdeletedrecords()
{   

    if($this->session->userdata('applicant_firstname') == '')
    {
        redirect('papplicant/login') ;
    }
    $profile = $this->m_applicant->showdeletedrecods('','');                                                         
    $total_rows = count($profile) ;
    $config['base_url'] =  base_url().'index.php/papplicant/viewdeletedrecords/' ;
    $config['per_page'] = '10' ;
    $config['full_tag_open'] = '<div>' ;

    $config['full_tag_close'] = '</div>' ;

    $config['first_link'] = 'First' ;

    $config['last_link'] = 'Last' ;

    $config['use_page_numbers'] = TRUE ;

    $config['prev_link'] = '&lt;' ;

    $config['uri_segment'] = 3 ;

    $config['num_links'] = 10 ;         

    $config['cur_tag_open'] = '<b>' ;

    $config['cur_tag_close'] = '</b>' ;

    $config['total_rows'] = $total_rows ;       

    $invoicepaginate = $this->m_applicant->showdeletedrecods( $config['per_page'], $this->uri->segment(3)) ;    

    $this->pagination->initialize($config);     

    $data4 = array(                             

    'data' => $invoicepaginate                                                                                       

    ) ;

    $this->load->view('applicant', $data4);

}

what is the use of $this->uri->segment(3) in codeigniter

whan I enter $this->uri->segment(3); it works as expected but when I enter $this->uri->segment(4); it stops working

解决方案

This provides you to retrieve information from your URI strings

$this->uri->segment(n); // n=1 for controller, n=2 for method, etc

Consider this example:

http://example.com/index.php/controller/action/1stsegment/2ndsegment

it will return

$this->uri->segment(1); // controller
$this->uri->segment(2); // action
$this->uri->segment(3); // 1stsegment
$this->uri->segment(4); // 2ndsegment

这篇关于$this->uri->segment(3) 在codeigniter分页中有什么用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆