PHP不显示任何错误消息。例如 :
<?php
require 'connect.php';
if(isset($_GET['last_name'] ,$_GET['first_name'])){
$last_name = trim($_GET['last_name']);
$first_name = trim($_GET['first_name']);
$people = $db->prepare("SELECT first_name, last_name FROM people
WHERE last_name=?");
$people = $db->bind_param('s',$last_name);//s for data type string
$people->execute();
$people->bind_results($first_name,$last_name);
while($people->fetch()){
echo $first_name. ' '.$last_name.'<br>';
}
echo $first_name;
}
?>
该程序有错误bind_results应该是bind_result,由于某种原因它没有显示php错误。
我也尝试了以下方法:
error_reporting(E_ALL);
并且在php.ini中,display_errors处于打开状态
最佳答案
尝试将其立即放在php标记(第2行)之后(也在connect.php文件中):
error_reporting(E_ALL);
ini_set('display_errors','On');
关于php - PHP中没有错误信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21939491/