PHP Error notice:undefined variable solution

Source: Internet
Author: User
source downloaded from the Internet, most of the time when debugging Undefined variable's error. In general, PHP does not need to define variables, but if the server error, there will be errors, so the server should be shielded from this error.

The source code downloaded from the Internet, in debugging most of the Undefined variable error occurred. In general, PHP does not need to define variables, but if the server error, there will be errors, so the server should be shielded from this error. Notice:undefined Variable:email in D:\PHP5\ENOTE\ADDNOTE. PHP on line 9 notice:undefined variable:subject in D:\PHP5\ENOTE\ADDNOTE. PHP on line 9 notice:undefined variable:comment in D:\PHP5\ENOTE\ADDNOTE. PHP on line 9 ...

In fact, the above is undefined variable, we directly judge the code of the variable caused. PHP does not need to define variables, but what should be the case? Just C:\WINDOWS find out the php.ini

in php.ini 302 lines error_reporting = E_all modified to error_reporting = E_all & ~e_notice Restart apache2.2.

Workaround: Modify php.ini to: error_reporting = E_all modified to: error_reporting = e_all & ~e_notice

If any errors do not want to let the display, directly modify: Display_errors = Off If you do not have php.ini Modify permissions, can be added to the PHP header: Ini_set ("error_reporting", "E_all & ~e_notice ");

  • 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.