我在共享服务器上安装了Symfony2,问题是我无法查看我在模板中调用的图像。
我的照片位于〜/ myApplication / web / images目录中。
我在twig模板中尝试了这些方法:
<img src="{{ asset('images/t.png') }}" alt="Twitter"/>
<img src="{{ asset('web/images/t.png') }}" alt="Twitter"/>
<img src="http://domain.fr/web/{{ asset('images/t.png') }}" alt="Twitter"/>
<img src="http://domain.fr/web/images/t.png" alt="Twitter"/>
但每次由http://domain.fr/web/images/t.png
转录,我都会http://domain.fr/web/images/t.png
。
我认为这是一个.htaccess问题,但我不是......
我的.htaccess到应用程序的根目录:
SetEnv SHORT_OPEN_TAGS 0
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_AUTOSTART 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5_3
AddType x-mapp-php5 .php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/app.php [QSA,L]
</IfModule>
有人可能知道这是什么?
我对CSS或JS文件没有任何问题,因为我将其添加到我的配置中:
framework:
templating:
assets_base_urls: http://domain.fr/web/
感谢您的帮助