$ db-> prepare($ sql)在PHP中做什么?

时间:2019-07-07 13:02:26

标签: php pdo

有人可以解释以下代码行吗:

$statement = $db->prepare($sqlInsert);

从下面的代码中:

<?php

include_once 'resource/Database.php';
var_dump($_POST);

if (isset($_POST['email'])) {
    $email    = $_POST['email'];
    $username = $_POST['username'];
    $password = $_POST['password'];

    $sqlInsert = "INSERT INTO users (username, email, password, join_date)
                        VALUES (:username, :email, :password, now())";

    //Sanitize whatever input users entered (advantage of PDO)
    $statement = $db->prepare($sqlInsert);
}
?>

0 个答案:

没有答案