1

由于服务器上的 sf_culture = 1,我遇到了很多错误。

{sfConfigurationException} Unable to find a matching route to generate url 
for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' =>'1',)"

在本地,这与默认路由匹配:

Match route "default" (/:sf_culture/:module/:action/*) for /de_DE/housing/legend with 
parameters array (  'module' => 'housing',  'action' => 'legend',  'sf_format' => 'html',  
'sf_culture' => 'de_DE',)

看起来像这样

default:
  url:   /:sf_culture/:module/:action/*
  param: { sf_format: html }
  requirements:
    sf_culture: (?:<?php echo $cultures ?>)

为什么 :sf_culture 或 $sf_user->getCulture() 甚至可能返回“1”,而且我在日志中看到了“de?keepthis=true”,这更奇怪。

我能做些什么来处理这个错误?

编辑:我不能是唯一一个有这个错误的人吗?我的意思是看看这些日志(~ 1 分钟)

May 10 09:50:23 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' => 'en“',)".
May 10 09:50:34 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' => 'mvcleltja',)".
May 10 09:50:45 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' => '√ en',)".
May 10 09:51:26 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' => '1',)".
May 10 09:51:42 symfony [err] {sfConfigurationException} Unable to find a matching route to generate url for params "array (  'action' => 'legend',  'module' => 'housing',  'sf_culture' => 'whwgopshwhyrydi',)".
4

1 回答 1

0

您可以通过 routing.yml (apps/appname/config/routing.yml) 限制 URL 中允许的文化,如下所示:

本地化_主页:
  网址:/:sf_culture/
  参数:{模块:你的模块,动作:你的动作}
  要求:
    sf_culture: (?:fr|en)
于 2012-07-16T22:33:46.180 回答