【发布时间】:2016-11-10 14:26:58
【问题描述】:
我有一张桌子电影:
1. id
2. title
3. content
4. links_id (foreign key)
我有一个表格链接:
1. id
2. name
3. url
我有页面 index.html.twig :
{% for link in movie.links %}
<a href="#{{ link.url }}" >{{ link.url }}</a>
{% endfor %}
我想查看电影的 url 链接表,它允许我根据 URL 重定向到站点。 例如,我在 Table Links 中有一些数据:
id:1 name : webSite1 url : www.webSite1.com
id:2 name : webSite2 url : www.webSite2.com
我在电影表中有一些数据:
id : 1
title : title1
content : content1
links_id : 1
当我显示带有链接的电影时 我试试这个:
{% for link in movie.links %}
<a href="{{ link.url }}" >{{ link.url }}</a>
{% endfor %}
当我点击 www.webSite1.com 时,在我看来该网址:
http://localhost/download/web/app_dev.php/downloads/Movie/show/www.webSite1.com
我会重定向到:www.webSite1.com
【问题讨论】:
标签: php symfony frameworks twig