Notice: undefinedindex .. troubleshooting

Source: Internet
Author: User
1. because the variable is undefined, we only need to find the relevant location and add the following code: function_get ($ str) {$ val! Emptyempty (... 1, because the variable is undefined, we only need to find the relevant location and add the following code:

Function _ get ($ str) {$ val =! Emptyempty ($ _ GET [$ str])? $ _ GET [$ str]: null; return $ val ;}

Or we can:

Isset ($ _ GET ['Your variable'])? $ _ GET ['Your variable']: '';

In the above example, we only use get and post, as long as we change the get to post. There is also a global definition method of the program:

If (! $ Cfg ['debug']) {error_reporting (0); ob_start ('OB _ gzhandler');} else {error_reporting (E_ALL ^ E_NOTICE );}

In this way, we only need to set the debug variable to 0 or 1 to switch the error message.

Methods provided by other web pages:

Method 1: modify the server configuration and modify the php. ini configuration file. error_reporting = E_ALL &~ E_NOTICE

Method 2: Add @ Before the notice code appears. @ indicates that the line has an error or the warning is not output. @ $ username = $ _ post ['username'];

Note: If you are using a global definition or modifying php. the ini configuration file does not display all the error prompts, which is quite troublesome for development and testing. we recommend that you use the program method to disable the error prompt on the server.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.