Setcookie statement problems

Source: Internet
Author: User
Setcookie statement, read the setcookie statement, and the error message is: Warning: Cannotmodifyheaderinformation-headersalreadysentby. Solution: open php_ini, search output_bufferfing, and remove the semicolon, change off to on

Error message:

Warning: Cannot modify header information-headers already sent

Solution:

Open php_ini, search for output_bufferfing, remove the semicolon, change off to on, or set a value. You can.

This is because of the setcookie statement.

There are some restrictions on the use of cookies, such:
1. call setcookie? Required? Before the tag
2. you cannot use echo before calling setcookie.
3. ?? Re-created? What is the cookie? In the program?
4. is the setcookie function required? In any? Expected? Before exiting the browser, send
5 .......

Based on the above? Some restrictions, so? When the row setcookie () function is used, usually? Encounter "Undefined index", "Cannot modify header information-headers already sent "... ??, Solution ?" Cannot modify header information-headers already sent by "this ?? The method is to delay the cookie before it is generated? To the browser. Therefore, 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.