Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我直接从 url 打印
if(isset($_GET['name']){ echo $_GET['name']) }
但是我的朋友告诉我,它现在很糟糕并且容易受到 XSS 的攻击,现在它有多糟糕,我应该怎么做才能防止 XSS?
只需在 htmlspecialchars 中包装不应包含标签的内容
echo htmlspecialchars($_GET["name"]);