PHP Jump-PHP hint "headers already sent by" specific how to modify!

Source: Internet
Author: User
Pure newcomer, jump code others help me write, the purpose is to jump, file for go.php
Jump to www.taobao.com when the URL is entered Go.php?id=taobao

An error occurred after changing the host
Warning:cannot Modify header Information-headers already sent by (output started at/data/home/... /go.php:8) in/data/home/... /go.php on line 10

Baidu know need to change php.ini but new host changed this is very troublesome. Do you have any way to modify the above errors directly in the PHP code of the above file?

Code:


  
   正在进入....
  
   

How should I change it? Thank you!!!

Reply content:

Pure newcomer, jump code others help me write, the purpose is to jump, file for go.php
Jump to www.taobao.com when the URL is entered Go.php?id=taobao

An error occurred after changing the host
Warning:cannot Modify header Information-headers already sent by (output started at/data/home/... /go.php:8) in/data/home/... /go.php on line 10

Baidu know need to change php.ini but new host changed this is very troublesome. Do you have any way to modify the above errors directly in the PHP code of the above file?

Code:


  
   正在进入....
  
   

How should I change it? Thank you!!!

go.php the role of the page only to make a judgment jump use, the HTML tag can be completely removed, the code of the go.php file only need to be streamlined to the remaining PHP:

php
  
   

如果还出现headers already sent 错误的话,就应该是编写代码的编辑器在文件开头隐藏了bom头信息,网上搜一下相关的编辑器对应方法即可。

如果要保留html代码,并且想要跳转的话,需要使用浏览器端页面跳转的方法,代码可以修改为:

php 正在进入.... "; break; case 'baidu': echo " "; break; case 'others': echo " "; break;}?>

【http-equiv实现跳转与header跳转有啥区别】请参照 http://segmentfault.com/q/1010000000703858

Put !--? php ...?--> code block at the top of the file.

The

Header () is used to send custom HTTP messages.
Note that the header () must be called before any actual output, whether it is an ordinary HTML tag, a blank line in the file, a space or a blank line in the php> file, or a space.
This is a very common mistake, if you have a space or a blank line before the header () is called, either through Include,require or by its access to the function in other files
.
If you are not invoking other files, just use a single PHP or HTML file, and there will be output errors before the header () is called.
PHP Manual

  • Related Article

    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.