Header ("location" $url) cannot be used in an if statement

Source: Internet
Author: User
Header ("location". $url) cannot be used in an if statement?
Header ("location". $url) cannot be used in if statement does not take effect
What are the general non-effective situations? PHP header ()


------Solution--------------------
Where's the colon? Where is it?
------Solution--------------------
The bottom of the
if ($mhavelogin ==1) {header ("Location:". $GameLoginUrl);} else{?> You have not landed, please login first

Change into

if ($mhavelogin ==1) {header ("Location:". $GameLoginUrl);} else{Echo ' You have not landed, please log in first ';}

Specific reasons you Baidu find out about the use of the header function to pay attention to the place it
------Solution--------------------
Writing PHP Code I hope you're in some places you're strict with yourself

Cannot have output before header

Some UTF8 format is not available in front of BOM

There is, jump can be JS implementation

echo "";
------Solution--------------------
Put the header ("content-type:text/html; Charset=utf-8 "); Move to else, all jump, what's the use of this?
------Solution--------------------
Reference:
Reference: Put the header ("content-type:text/html; Charset=utf-8 "); Move to else, all jump, what's the use of this?
This is a login interface, want to click the login button to jump directly


I mean, you jump, you don't have to export any more headers.
  • 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.