如何为cakephp 3 plguin创建语言路线
这必须与EmployeerPanel中的插件一起使用插件,页面控制器和动作是语言en的主页如何为cakephp 3 plguin创建语言路线,php,cakephp-3.0,Php,Cakephp 3.0,这必须与EmployeerPanel中的插件一起使用插件,页面控制器和动作是语言en的主页 Router::scope('/:language/employer/', ['plugin' => 'EmployerPanel'], function ($routes) { $routes->prefix('employer',function ($routes) { $routes->connect(':language/:controller',['
Router::scope('/:language/employer/', ['plugin' => 'EmployerPanel'], function ($routes) {
$routes->prefix('employer',function ($routes) {
$routes->connect(':language/:controller',['plugin'=>'EmployerPanel']);
});
$routes->fallbacks('InflectedRoute');
});
但它在调试请求中
http://localhost/mmjob/en/empoyer/pages/home
如何处理\u matchedRoute=/:language/:plugin/:controller:/:action
尝试以下操作:
language => en
controller => Employer
action => pages
pass(array)
plugin(null)
_matchedRoute/:language/:controller/:action/*
_ext(null)
仅适用于此链接就可以了@这还不能回答你的问题吗?你需要插件名来传递吗?我想在你的EmployerPanel>PagesController>中为整个Employer-panel@Jsonras thankSo传递一个语言路径,你有一个名为home right的函数。公共函数home($language=null,$employer=null)。将这两个参数放在home函数中,一旦调用它,您就可以访问语言代码和雇主。
Router::plugin(
'EmployerPanel',
['path' => '/employer-panel'],
function ($routes) {
$routes->connect('/:language/employer/', ['plugin' => 'EmployerPanel', 'controller' => 'Pages', 'action' => 'home']);
$routes->fallbacks('InflectedRoute');
}
);
Go to http://localhost/mmjob/employer-panel/en/employer