English 中文(简体)
消除PHP未界定的可变信息?
原标题:Suppressing PHP undefined variable messages?
  • 时间:2011-10-06 05:58:56
  •  标签:
  • php

当我开发了一个当地服务器的网站时,它正在做罚款。

Now that I ve uploaded it live I m getting several notices.

Notice: Undefined index: ... on line 14

我已经指出,这种情况之所以发生,是因为Im使用收入指数界定的变量,希望通过和确定。 但是,我需要一个一夜工作的生活版本。

Is it possible to suppress the Notices and have the website act as it does on my localhost while its on my live server?

最佳回答

你们可以选择哪类错误将在网站通过php.ini或通过(htaccess for specific rafters)或以error_ reporting(<><>/code>表示。

http://www.php.net/manual/en/Function.error- reporting.php“rel=“noretinger” www.php.net/manual/en/Function.error- reporting.php。

另见:

问题回答

你们两度错了。 在你的地方招待会和你的生活服务器上!

Localhost

  • Always show everything on screen, you want to know about notices too before you go live, as you can see now!

Live server

  • Never show anything on screen, it makes you vulnerable (it s deadly)
  • Log everything, also notices! So don t do what the other answers tell you!

查阅文件php.ini,内容类似于error_ reporting = E_STRICT - Edit it tomov the STRICT bit and put in error_ reporting = E_ERROR

我建议,在不久的将来,你纠正这些错误。





相关问题
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 ...