English 中文(简体)
消除和恢复错误——购买力平价报告水平
原标题:Save and restore error_reporting level in PHP

我有一个充满错误的问题——报告职能。

I want to save current error_reporting level, disable error reporting for few lines, and restore it back. So I have following code:

$oldErrorReporting = error_reporting();
error_reporting(0);
//Some code, that will generate warning, or error, that I don t want to show
error_reporting(oldErrorReporting);

So, if I remove last line, there are no errors, and everything works fine. But if I add last line, I got error that happen in code while error reporting was turned off. So, is there any was to clear those errors that happen while error_reporting level was 0, and restore default error reporting level, without those errors that happen while error report was tuned off?

问题回答

也许这只是一个打字体(如果是的话,请don t rewrite Code for a question, Just拷贝&paste(并删除令人不安的字体),但你要放弃$-sign in their final line:

error_reporting($oldErrorReporting);

哪类法典会产生警告? 如果是个县,而不是降低减员水平,以压制警告本身——在职能名称前写“@”。

a. 检查:

Suppress mis with @营运人 in PHP





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签