- 在twig的html <a>标签中
<li><a href="{{ path('championfocus_all', {'gameCategory': 1}) }}">DOTA冠军玩法焦点图</a></li>
2. 在ajax中的url
$.ajax({
url: "{{ path('quiz_update_head_count', {'id': entity.id }) }}",
type: 'post',
data: { headCount: headCount },
dataType: 'json',
success: function(response){
if(response.code == 404)
{
alert(response.message);
}else if(response.code == 405){
alert(response.message);
}else {
alert("最终人头数为" + headCount);
}
},
error: function() {
alert("网络出问题了");
}
});