因此,本周我将尽可能地保护我的 PHP 应用程序。我经常从数据库中检索数据,因此我需要一些基本技巧来帮助我保护以下代码。
谢谢,我只是个新手。
<?php
mysqli_select_db($connect,"users");
$select="select * from members";
$result=mysqli_query($connect,$select);
$row=mysqli_fetch_array($result);
//this is what i want to secure -- down
$a = $row['name'];
$b = $row['add'];
?>
谢谢。
最佳答案
使用 htmlspecialchars()
对您希望在浏览器中显示的用户输入/数据库中的所有内容 进行编码,以避免 XSS .
关于php - 使用 PHP 保护获取的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4867200/