当我访问网址时http://www.example.com/Formación
然后路由应该匹配,但它不起作用,因为我有一个字符ó
,如何使这个ó
西班牙语字符与ZF中的以下路由兼容?
$route = Http\Segment::factory(array(
'route' => '/Formación', //<<<<< this character must be used: ó
'defaults' => array(
'controller' => 'Application\Controller\Trainingsignup',
'action' => 'index'
),
));
$router->addRoute('traininges', $route, null);
编辑:也失败了
'constraints' => array(
'controller' => '[a-zA-ZóäöüÄÖÜß][a-zA-ZóäöüÄÖÜß0-9_-]+',
'action' => '[a-zA-ZóäöüÄÖÜß][a-zA-ZóäöüÄÖÜß0-9_-]+',
),
编辑:也失败了
'constraints' => array(
'controller' => '/^\p{L}[\p{L} _.-]+$/u', //or /[\p{L}]+/u
'action' => '/^\p{L}[\p{L} _.-]+$/u', //or /[\p{L}]+/u
),
答案 0 :(得分:1)
我诚实的回答是:不要做 - 请使用ASCII。
但如果你真的想要:How to set a (UTF8) modifier for RegEx of a RegEx Route in Zend Framework 2?