小编use*_*876的帖子

查询参数的Symfony2 Charset

我在Symfony2中有一个项目,它在我的本地主机上运行良好,但在将其移动到外部服务器后问题已经开始.

  1. 我没有看到数据库中包含波兰字符的任何结果名称
  2. 在Profiler中我检查了查询:
    • 'Parameters'部分有正确的字符集
    • 'runnable query'具有相同的参数但具有错误的字符集

例如:

(...) WHERE ((((c1_.name LIKE '%Å?%') OR (c3_.name LIKE '%Å?%') OR (..) Parameters: ['%?%', '%?%', (...)]

所有数据库表都有charset = utf8_unicode_ci.

在config.yml我设置

doctrine: 
    dbal: 
      charset: UTF8 
Run Code Online (Sandbox Code Playgroud)

设置框架charset不起作用.

/config.php测试说:

RECOMMENDATIONS:
  1. Install and enable a PHP accelerator like APC (highly recommended).
  2. Set short_open_tag to off in php.ini*.
  3. Set magic_quotes_gpc to off in php.ini*.
  * Changes to the php.ini file must be done in "/usr/local/php/php.ini".
Run Code Online (Sandbox Code Playgroud)

但不幸的是,我无法访问该服务器上的php.ini.这可能是magic_quotes_gpc导致了这个问题吗?我也无法访问命令行,所以我通过ftp和phpmyadmin添加了项目(数据库,文件系统,供应商).

Becouse我在本地主机上没有问题我猜这是服务器配置的问题,我无法访问它,我看到的唯一方法是尝试更改QueryBuilder的charset配置.我在哪里可以做到的?你知道还有什么可能导致这个问题吗?

谢谢

configuration character-encoding query-builder symfony

7
推荐指数
1
解决办法
4148
查看次数