【发布时间】:2018-06-03 06:23:37
【问题描述】:
我的代码中有这样的错误
致命错误:未捕获错误:调用未定义函数 C:\xampp\htdocs\wp\server.php:12 中的 mysql_real_escape_string() 堆栈 跟踪:#0 C:\xampp\htdocs\wp\register.php(1): include() #1 {main} 在第 12 行的 C:\xampp\htdocs\wp\server.php 中抛出
我的代码是
$username="";
$email="";
$errors=array();
//conct to sever
$db = mysqli_connect('localhost','registration');
//register button click
if (isset($_POST['register'])){
$username=mysql_real_escape_string($conn,$_POST['username']);
$email=mysql_real_escape_string($conn,$_POST['email']);
$password_1=mysql_real_escape_string($_POST['password_1']);
$password_2=mysql_real_escape_string($_POST['password_2']);
谁能解释一下php中mysql_real_escape_string()的作用是什么?
【问题讨论】:
-
它已被弃用。所以请看这里link
-
您使用的是 PHP 7 吗?那就看stackoverflow.com/questions/12859942/…