Problems with Setcookie statements

Source: Internet
Author: User
Tags numeric value setcookie

The error message appears:

Warning:cannot Modify header Information-headers already sent by

Solution:

Open Php_ini, search for output_bufferfing, remove the preceding semicolon, modify off to on, or set a numeric value. It's OK.

This type of statement is caused by the problem of the Setcookie statement.

The cookie itself has some restrictions on its use, such as:

1. Call Setcookie? Before the label.

2. Do not use echo before calling Setcookie

3. Until?? After being reopened, does the cookie just get out of the program?

4.setcookie function must be sent out to the browser before any

5 .....

Based on the above restrictions, so the line Setcookie () function, often hit the "Undefined index", "Cannot modify header Information-headers already sent by" ... Wait a minute? Cannot modify header information-headers already sent by "this?? The method is to delay the output of the feed to the browser before the cookie is generated, so you can add Ob_start () to the front of the program; This will solve the problem.

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.