在控制器有個變量$privilage,其值為1~~3,如何讓模板文件的<td.....>更新</td>處用此$privilage變量來判斷其是否顯示?例如:{% if privilage==2 or privilage==3 %}????????????????<td......>更新</td>???????????{% endif %}此方法已試,不行。求大神指點迷津,菜鳥小弟不慎感激。
2 回答

夢是藍的
TA貢獻4條經驗 獲得超0個贊
V層就這樣.
{% if error %}
?<div class="alert alert-danger">{{ error.message|trans }}</div>
{% endif %}
----------------------------------
C層就這樣.
return $this->render('TopxiaWebBundle:Login:index.html.twig', array(
? ?'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
? ?'error' ? ? ? ? => $error,
? ?'_target_path' ?=> $this->getTargetPath($request)
));
- 2 回答
- 0 關注
- 1537 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消