Symfony sf_culture = 1 错误 [英] Symfony sf_culture = 1 error

查看:14
本文介绍了Symfony sf_culture = 1 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

{sfConfigurationException} 无法找到匹配的路由来生成 url对于参数数组('action' => 'legend', 'module' => 'housing', 'sf_culture' =>'1',)"

本地匹配默认路由:

将/de_DE/housing/legend 的路由default"(/:sf_culture/:module/:action/*)与参数数组('module' => 'housing', 'action' => 'legend', 'sf_format' => 'html','sf_culture' =>'de_DE',)

看起来像这样

默认:网址:/:sf_culture/:module/:action/*参数:{sf_format:html}要求:sf_culture: (?:<?php echo $cultures ?>)

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

我该怎么办这个错误?

我不能是唯一出现此错误的人吗?我的意思是看看这些日志(约 1 分钟)

5 月 10 日 09:50:23 symfony [err] {sfConfigurationException} 无法找到匹配的路由来为 params array ( 'action' => 'legend', 'module' =>'housing', 'sf_culture' => 'en√¢‚Ǩ≈ì',)".5 月 10 日 09:50:34 symfony [err] {sfConfigurationException} 无法找到匹配的路由来为参数数组"生成 url(action"=>legend",module"=>housing",sf_culture"' => 'mvcleltja',)".5 月 10 日 09:50:45 symfony [err] {sfConfigurationException} 无法找到匹配的路由来为参数array"生成 url(action"=>legend",module"=>housing",sf_culture"' => '√ en',)".5 月 10 日 09:51:26 symfony [err] {sfConfigurationException} 无法找到匹配的路由来为参数array"生成 url(action"=>legend",module"=>housing",sf_culture"' => '1',)".5 月 10 日 09:51:42 symfony [err] {sfConfigurationException} 无法找到匹配的路由来为参数array"生成 url(action"=>legend",module"=>housing",sf_culture"' => 'whwgopshwhyrydi',)".

解决方案

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

<前>localized_homepage:网址:/:sf_culture/参数:{ 模块:你的模块,动作:你的动作}要求:sf_culture: (?:fr|en)

I'm getting a lot of errors because of sf_culture = 1 on the server.

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

Locally this matches the default route:

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',)

wich looks like this

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

Why is it even possible that :sf_culture or $sf_user->getCulture() is returning '1', also I have seen 'de?keepthis=true' in the logs which is even more strange.

What can I do about this error?

EDIT: I can't be the only one with this error? I mean just look at these logs (~ 1 Minute)

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',)".

解决方案

You can restrict the allowed cultures in your URLs via the routing.yml (apps/appname/config/routing.yml) like so:

localized_homepage:
  url: /:sf_culture/
  param: { module: yourmodule, action: youraction }
  requirements:
    sf_culture: (?:fr|en)

这篇关于Symfony sf_culture = 1 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆