Error message that appears:
Warning: Cannot modify header information - headers already sent by
Solution:
Open php_ini, search output_bufferfing, remove the semicolon in front, change off to on, or set a value. That's it.
This type of statement causes this problem because of the setcookie statement.
Cookies themselves have some limitations on their use, such as:
1. The statement for calling setcookie must be placed before the tag.
2. Echo cannot be used before calling setcookie.
3. The cookie will not exit the program until the program is re-entered.
4. The setcookie function must be sent before any data is sent to the browser.
5....
Based on the above restrictions, when executing the setcookie() function, you often encounter "Undefined index", "Cannot modify header information - headers already sent by"... etc., the solution is "Cannot modify header" The method of "information - headers already sent by" is to delay the output of information to the browser before generating a cookie. Therefore, you can add the ob_start(); function at the front of the program. This will solve it.