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

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

问题描述

听到是我的代码

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);

}

$this->uri->segment(3)在代码初始化器中的用途

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

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

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

推荐答案

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

This provides you to retrieve information from your URI strings

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

请考虑以下示例:

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

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

它将返回

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

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

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