Router::redirect() is deprecated. Use Router::scope() and RouteBuilder::redirect() instead.
该消息提供了一些线索,但没有在文档中找到直接答案。
直接切换到RouteBuilder::redirect()
而不是不可能的,因为它不是静态功能。
Router::redirect() is deprecated. Use Router::scope() and RouteBuilder::redirect() instead.
该消息提供了一些线索,但没有在文档中找到直接答案。
直接切换到RouteBuilder::redirect()
而不是不可能的,因为它不是静态功能。
好的,我最终发现了问题。一旦您Router::scope()
正确阅读了文档中的用法并注意到您将RouteBuilder
对象作为函数的参数,这很容易。
文档:https ://book.cakephp.org/3/en/development/routing.html#quick-tour
原始(已弃用)
Router::redirect('/old', '/new');
新的
Router::scope('/', function ($routes) {
$routes->redirect('/old', '/new');
});