我特别傻眼。问题是什么?我已经从http://www.php.net/manual/en/mysqli-stmt.bind-param.php复制了默认的 PHP OOS ,它一直在抛出错误。
<?php
$mysqli = new mysqli('localhost', 'root', 'hidden', 'hidden');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = $mysqli->prepare("INSERT INTO users VALUES (?, ?)");
$stmt->bind_param('ss', $name, $password);
$name = "Test";
$password = "Test";
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
/* close statement and connection */
$stmt->close();
/* close connection */
$mysqli->close();
?>
致命错误:在第 11 行的 C:\xampp\htdocs\cms\index.php 中的非对象上调用成员函数 bind_param()