简体   繁体   English

需要帮助在Codeigniter中检索uri段

[英]Need help retrieving a uri segment in codeigniter

I have a url in CodeIgniter with an encrypted value. 我在CodeIgniter中有一个带有加密值的url But when I try to get the uri segment CodeIgniter was not able to find it. 但是,当我尝试获取uri段时,CodeIgniter无法找到它。

Is there anyway where i can use a prefix to find it?? 无论如何,我可以使用前缀找到它吗? Below is the url I am using 以下是我正在使用的网址

localhost/sandbox/index.php/client/applicants/applicantslist/index?proj=ijo7w%2BriCislarU8QCJZNXc7s7C3mI%2BVYoN49uFSf9U%3D/5

  //Set 11 for testing purposes
   $config['total_rows'] = 11;

    $config['per_page'] = 5;

    $config['num_links'] = 4;
    $config["prefix"] = "page=";

 // Showing nothing
    fb($this->uri->segment("5"));

A segment is a part of the url itself, ie index is available or applicantslist is available. 段是URL本身的一部分,即可以使用index或可以使用applicantslist

Anything after the ? 什么之后? is within the scope of $_GET variables or with codeigniter $this->input->get() 在$ _GET变量范围内或带有代码点火器$this->input->get()

It looks like you should be using $this->input->get('proj') in your case 看来您应该在情况下使用$this->input->get('proj')

The answer that I came up with is by adding the get query string in the $config['suffix'] like so ... 我想出的答案是像这样在$ config ['suffix']中添加get查询字符串。

$config['suffix'] = 'id?30'

The only problem with that is when I went back to the first page the it would just show the base url without the get params. 唯一的问题是,当我返回首页时,它将只显示基本URL,而没有get参数。 In order to fix that I would do the following 为了解决这个问题,我将执行以下操作

   $config['first_url'] = $config['base_url'].'?'.http_build_query($_GET);

and that solved the problem! 这样就解决了问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM