显示所有错误和警告更新2:我现在已经从.php文件中删除了以下内容:<?php error_reporting( E_ALL ); ?>我已经将php.ini中的display_erros设置为:显示误差=ON在php.ini中,错误报告设置为错误报告=E_ALL\E_严格重新启动Apache之后,我仍然没有收到任何错误/警告。更新1:我将php.ini中的错误报告更改为:错误报告=E_ALL&~E_不推荐到错误报告=E_ALL\E_严格之后,我重新启动了Apache。/etc/init.d/apache2重新启动但是页面仍然不会显示任何类型的错误/警告。原题:以下脚本生成警告,因为$err位于if语句中。为什么这个警告没有显示在网页浏览器的PHP页面上?我必须查看Apache日志才能看到警告。另外,如果我故意将“INSERT INTO”更改为“DELETE INTO”,它不会在PHP页面上显示错误。为什么错误没有显示在实际的PHP页面上?<?php
error_reporting( E_ALL );?><html>
<head>
<title></title>
<link rel="icon" type="image/png" href="favicon.ico">
<?php if( $_SERVER['REQUEST_METHOD']=='POST' ) {
$err = array();
if( empty( $_POST['display_name'] ) ) $err[] = "display name field is required";
if( empty( $_POST['email'] ) ) $err[] = "email field is required";
if( empty( $_POST['password'] ) ) $err[] = "password field is required";
if( !$err ) {
try {
$DBH = new PDO( "mysql:host=localhost;dbname=database1", "user", "pass" );
$DBH -> setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$STH = $DBH -> prepare( "delete into table1 (display_name, email, password)
values ( :display_name, :email, :password )" );
$STH -> bindParam( ':display_name', $_POST['display_name'], PDO::PARAM_STR, 100 );
$STH -> bindParam( ':email', $_POST['email'], PDO::PARAM_STR, 100 );
$STH -> bindParam( ':password', $_POST['password'], PDO::PARAM_STR, 100 );
$STH -> execute();
$STH = $DBH -> prepare( "delete into table2 ( username, status, users_id )
values ( :username, :status, :users_id )" );
$strStatus = 1
- 4 回答
- 0 关注
- 489 浏览
添加回答
举报
0/150
提交
取消