过滤URI字符串参数的表单

时间:2016-12-01 13:20:37

标签: php codeigniter

对于已过滤的列表网页,我希望URI字符串中包含传递过滤器。即:

index.php/user/search/name/joe/location/UK/gender/male

根据CodeIgniter文档,使用URI类可以轻松检索信息。 http://www.codeigniter.com/user_guide/libraries/uri.html?highlight=uri%20class

我怀疑:

在视图中,我应该如何设置过滤器表单以便它调用基于uri字符串的url( index.php / user / search / name / joe / location / UK / gender / male )而不是常规的POST(或GET)请求?

1 个答案:

答案 0 :(得分:0)

而不是这样做,你可以像这样构建你的查询,

index.php/user/search?name=joe&location=UK&gender=male

这样您就可以使用$data = $this->input->get()访问网址参数,然后访问$data['name'], $data['location'] and $data['gender']等单个项目。 使用get方法设置表单也更容易。

相关问题