是否可以使用error_reporting(0)来摆脱错误消息? [英] Is it ok to use error_reporting(0) to get rid of error msg?
问题描述
嗨
我正在为我的网站创建留言板,我是新手
并使用了几个教程并将它们定制为什么我需要使用
我得到的一些小知识。
我的代码中出现以下错误:
注意:未定义的变量:c:\ program中的星星
$ 60 $ b files \easyphp1-7 \ www.hn在第60行输入
哪个我我的代码本地消失了(PHP.ini仍然是
设置为2047):
<?PHP
error_reporting(0);
?>
这样做可以吗?或者这是一个便宜的快速解决方案?我想学习PHP
正确的方法。
非常感谢
Patrick
Hi
I am in the process of creating a guestbook for my site, I am a newbie
and used several tutorials and customized them to what I need using the
little knowledge I got.
I get the following error in my code:
Notice: Undefined variable: stars in c:\program
files\easyphp1-7\www\guestbook\add.php on line 60
Which I got to disappear with this locally in my code (PHP.ini still
set to 2047):
<?PHP
error_reporting(0);
?>
Is it ok to do that? Or is it a cheap quick fix? I want to learn PHP
the right way.
Thanks a bunch
Patrick
推荐答案
" varois83"写道:
"varois83" wrote:
嗨
我正在为我的网站创建留言簿,我是一个
新手并使用了几个教程并将它们定制为我的内容需要使用
我得到的小知识。
我的代码中出现以下错误:
注意:未定义的变量:c:\ program中的星号<第60行上的文件\easyphp1-7 \过去了一下我们在我的代码中用本地消失了(PHP.ini
)仍然设置为2047):
<?PHP
error_reporting(0);
?>
这样做可以吗?或者这是一个便宜的快速解决方案?我想以正确的方式学习
PHP。
感谢一群
Patrick
Hi
I am in the process of creating a guestbook for my site, I am a newbie and used several tutorials and customized them to what I need using
the
little knowledge I got.
I get the following error in my code:
Notice: Undefined variable: stars in c:\program
files\easyphp1-7\www\guestbook\add.php on line 60
Which I got to disappear with this locally in my code (PHP.ini still set to 2047):
<?PHP
error_reporting(0);
?>
Is it ok to do that? Or is it a cheap quick fix? I want to learn PHP the right way.
Thanks a bunch
Patrick
Patrick ,建议你保留尽可能多的错误报告,以确保你已经充分调试了你的代码。
至于未定义的变量,定义它们总是更好。
但是我发现我可以使用未定义的变量以及
,因为我完全一致。所以这是程序员
选择恕我直言。
http://ca.php.net/manual/en/function...-reporting .php 非常值得
阅读。
-
发表时使用 http://www.dbforumz.com 界面,应作者的要求
单独的文章检查是否符合usenet标准
主题网址: http://www.dbforumz.com/PHP-error_re...ict189490.html
访问主题网址以联系作者(reg.req'' d)。举报滥用行为: http://www.dbforumz.com/eform.php ?p = 640399
Patrick, it is recommended that you keep as much error reporting as
possible, to make sure you have sufficiently debugged your code.
As far as undefined variables, it is always better to define them.
But I have found that I can work with undefined variables as well as
long as I am totally consistent about it. So it is the programmers
choice IMHO.
there are some great discussions in the comments section of
http://ca.php.net/manual/en/function...-reporting.php well worth
reading.
--
Posted using the http://www.dbforumz.com interface, at author''s request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-error_re...ict189490.html
Visit Topic URL to contact author (reg. req''d). Report abuse: http://www.dbforumz.com/eform.php?p=640399
我注意到Message-ID:< 41 ********** @ alt.athenanews.com>来自史蒂夫
包含以下内容:
I noticed that Message-ID: <41**********@alt.athenanews.com> from steve
contained the following:
使用 http://www.dbforumz.com 界面,应作者的要求
文章单独检查是否符合usenet标准
Posted using the http://www.dbforumz.com interface, at author''s request
Articles individually checked for conformance to usenet standards
OBTopic:在引号字符前没有显示空格
一致性。
-
Geoff Berrow (把它发给电子邮件)
它只是Usenet,没有人死。
我的意见,而不是我的委员会。
简单的RFD http://www.ckdog.co.uk/rfdmaker /
.oO(varois83)
.oO(varois83)
我的代码中出现以下错误:
注意:未定义的变量:第60行中的c:\ program
files\easyphp1-7\\\\guestbook\add.php中的星号
我的代码本地消失了(PHP.ini仍然设置为2047):
<?PHP
error_reporting( 0);
?>
这样做可以吗?
No.
或者它是一个便宜的快速修复?我想以正确的方式学习PHP。
I get the following error in my code:
Notice: Undefined variable: stars in c:\program
files\easyphp1-7\www\guestbook\add.php on line 60
Which I got to disappear with this locally in my code (PHP.ini still
set to 2047):
<?PHP
error_reporting(0);
?>
Is it ok to do that?
No.
Or is it a cheap quick fix? I want to learn PHP
the right way.
在开发盒的php.ini中将error_reporting设置为E_ALL并且
修复PHP抱怨的事情。即使它只是一个通知 - 它是错误的代码并且可能导致很难找到的错误。例如,如果
你写了
Set error_reporting to E_ALL in the php.ini on your development box and
fix the things PHP complains about. Even if it''s just a notice -- it''s
bad code and might lead to bugs which are hard to find. For example if
you write
这篇关于是否可以使用error_reporting(0)来摆脱错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!