CakePHP自定义路由分页 [英] CakePHP custom route pagination

查看:87
本文介绍了CakePHP自定义路由分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要格式化我的网址,如下所示:

I would like to format my URL like so:

/ news / index / page:2

/ news / 2

我想通过使用尽可能少的代码(或许只从routes.php?)来实现这个结果,而不修改PaginatorHelper的行为。

I would like to achieve this result by using as less code as possible (perhaps only from routes.php?), without modifying how the PaginatorHelper behaves.

感谢您的帮助!

推荐答案

这应该可以工作

// Add this to /app/config/routes.php
Router::connect('/news/:page', array('controller' => 'news', 'action' => 'index'));

这篇关于CakePHP自定义路由分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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