php 的错误调试,php错误调试

Php错误的类别,主要有以下三大类:

1. 语法错误

程序这种情况通常在执行的时候,会显示错误信息(报错)。这种类型错误会阻止页面php脚本执行其他任务。如:

Warning: Cannot modify header information - headers already sent by (output started at E:\PhpProject1\test.php:7) in E:\PhpProject1\test.php on line 8

3. 程序逻辑错误

这种错误不但不会阻止php脚本的执行,也不会显示错误信息。一般用的调试程序手段是异常处理.如

”;

var_dump();

echo"

+++++++++++++++++++++

";

echo "This ia a Warning level Warning: Wrong parameter count for var_dump()...";

echo “

”;

ech “This is a demo”;

echo"

+++++++++++++++++++++

";

echo "This ia a Warning level Warning: Wrong parameter count for var_dump()...";

?>

ini_set()

Sets the value of a configuration option

string ini_set ( string $varname , string $newvalue )

Sets the value of the given configuration option. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.

为给出(指定)的配置选项赋值,在程序执行的过程中,配置选项将保持使用这个新赋给的值。当程序执行完成时,配置选项将恢复系统的默认值。

ini_set(‘display_errors’,1); 开启php.ini中的display_errors

error_reporting(E_ALL);

报错程序所有的错误、警告和注意。

error_reporting(E_ALL);

ini_set(‘display_errors’,1);

作者“我的PHP之路”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值