我是Symfony的新手。有沒有辦法讓TWIG訪問安全配置文件中的頁面access_control設置?
我想要一段代碼只顯示在公開的網頁上。 Twig能夠檢測頁面是否公開?
該頁面在IS_AUTHENTICATED_ANONYMOUSLY
下,但我仍然希望顯示一段代碼,即使用戶已經登錄。
For Example:
www.somesite.com (shows the code, publicly available)
www.somesite.com/login (user login, publicly available, shows code)
//user is not logged in
www.somesite.com/dosomething (only available to logged-in users, code is hidden)
//user goes to the home page, still logged-in
www.somesite.com (must show the code, publicly available)
我知道我可以手動包含我的公共頁面的代碼,但有沒有辦法自動檢測頁面是否在防火牆之外?
請幫忙。 =)
對不起,我修改了這個問題,使其更清晰。希望你得到了答案=) – bernardnapoleon