I got PHP on the first day and crashed. are all errors reported?

Source: Internet
Author: User
On the first day, PHP crashed. all the errors were reported ??? If ($ _ GET [all] yes) {& nbsp; echo & nbsp; hi; & nbsp;} error: Notice: & nbsp; Undefined & nbsp; index: & nbsp; all & nbsp; in & nbsp; C ???

if($_GET['all']=='yes')
{
echo "hi";
}

Error: Notice: Undefined index: all in C: \ Users \ Administrator \ Downloads \ PHPnow-1.5.6.4237493736 \ htdocs \ oa \ manage. php on line 71

The younger brother is confused about the difference between an equal sign and an equal sign.
In addition, if it is changed to an equal sign, there is no error, but this statement is useless. there will be hi if all = yes is displayed on the url, and there will still be hi if there is no all = yes on the url.

------ Solution --------------------
If (isset ($ _ GET ['all']) & $ _ GET ['all'] = 'yes ')
{
Echo "hi ";
}
------ Solution --------------------
$ _ GET ['all'] is not defined. it is not an error, but a prompt.

You can use the isset () method to determine whether the value has been defined and then set the value.

For example:

if(isset($_GET['all']) && $_GET['all']=='yes')
{
echo "hi";
}

------ Solution --------------------
An equal sign is a value assignment.
The two equal signs are equal

You should first use isset to determine the correct method.

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.