gpt4 book ai didi

php - 何时在 Laravel 中使用双大括号?

转载 作者:行者123 更新时间:2023-12-02 13:16:32 25 4
gpt4 key购买 nike

我想知道 Laravel 中何时使用 {{}} 以及何时使用 {!!!!}?我知道这是一种防止 XSS 的方法,但我发现所有开发人员都使用 {{}} 来表示图像地址、样式表地址、脚本地址等,而据我所知,XSS 是恶意用户可以完成的事情INPUT 不是静态的、由开发人员设置的。我说得对吗?

谢谢

最佳答案

来自Laravel docs :

By default, Blade {{ }} statements are automatically sent through PHP's htmlentities function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax:

Hello, {!! $name !!}.

关于php - 何时在 Laravel 中使用双大括号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42467369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com