带有获取参数的 codeigniter 分页 URL [英] codeigniter pagination url with get parameters

查看:30
本文介绍了带有获取参数的 codeigniter 分页 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 URL 中传递参数时,我无法在 codeigniter 上设置分页

I am having trouble setting up pagination on codeigniter when I pass parameters in the URL

如果我的网址是这样的:search/?type=groups

if my url is like this : search/?type=groups

我的 $config['base_url'] 应该是什么才能让分页工作?

what should be my $config['base_url'] for pagination to work?

如果我将基本 url 设置为 search/?type=groups 生成的 url 是 search/?type=groups/10

if i set the base url to search/?type=groups the resulting url is search/?type=groups/10

这意味着 $_GET['type']=groups/10

谢谢

推荐答案

解决方案是 CodeIgniter 没有那样的功能.我需要的是类型"中每个选项的方法(在控制器中)所以一个选项是一种称为 :groups 的方法,另一种称为条目等每个方法根据需要引用不同的模型类或方法.

The solution is that CodeIgniter does not function like that. what I need is a method ( in the controller ) for each one of the options in "type" so one option would be a method called :groups , another called entries etc etc each method refers to a different model class or method as needed.

我正在努力更好地理解 OOP 和 CI ......做一些调整......如果我错了,请随时发表评论并纠正我.谢谢

I am trying to better understand OOP and CI ...a bit of adjusting to do ... feel free to comment and correct me if i am wrong. thank you

这篇关于带有获取参数的 codeigniter 分页 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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