我的网址已映射,例如:
localhost/seo-url/seo-variable
如果未映射的网址如下所示:
localhost/controller-name/index/2
$routes->connect('/seo-url/:product_id',[,'controller' => 'ControllerNames', 'action' => 'index','product_id' => null],['pass' => [product_id'],'product_id' => '[a-z0-9\-_]+']); ------- CakePHP 3.1 v
分页链接错误,如下所示:
localhost/controller-name/index/seo-variable?page=1
localhost/controller-name/index/seo-variable?page=2
localhost/controller-name/index/seo-variable?page=3
我试过这个,但遗憾的是没有帮助:
<?php $this->Paginator->options(['url' => ['controller' => 'ControllerNames', 'action' => 'index', 'product_id' => $product->id]]); ?>
结果错了:
localhost:9080/controller-name?page=1&product_id=2<br>
localhost:9080/controller-name?page=2&product_id=2<br>
localhost:9080/controller-name?page=3&product_id=2<br>
我需要更改正确显示的链接吗?
解决方案A
localhost/seo-url/seo-variable?page=1
localhost/seo-url/seo-variable?page=2
localhost/seo-url/seo-variable?page=3
OR
解决方案B
localhost/controller-name/index/2?page=1
localhost/controller-name/index/2?page=2
localhost/controller-name/index/2?page=3
我的英语不好,但我希望你明白我的意思。