简体   繁体   中英

Symfony, assets doesn't include current folder in the url

I'm working in a project that had Symfony 3.0.4, in this version we use asset to add the path of web folder to the assets like:

{{ asset('filemanager/fileUploadedByAdmin.jpg') }}

It works perfectly in production and in local servers (Wamp servers) generating urls like:

http://localhost/projectName/web/filemanager/fileUploadedByAdmin.jpg

Then the project was updated to the version 3.4.2 and now the same line generates something like:

http://localhost/filemanager/fileUploadedByAdmin.jpg

And the files aren't found. There is a way or configuration to get the same result in the 3.4.2 version?

You can use this code:

{{ absolute_url(asset('filemanager/fileUploadedByAdmin.jpg')) }}

to generate the absolute URL of an asset using absolute_url function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM