Warning: session_ start() [function.session-start]: Cannot send session cookie – headers already sent by
When configuring PHP websites, warning: session often appears at the top of the page_ Start() [function. Session start]: cannot send session cache limiter, nor does it affect page opening.
Warning: session_ start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at D:\orther object\phptest\session.php:1) in D:\orther object\phptest\session.php on line 2
1. If you use Dreamweaver and UTF-8 coding, right click on a page = = & gt; Page properties = = & gt; Title/code, you will see a check box “including Unicode signature (BOM) (s)”, and you can cancel it. This is because the UTF-8 encoding file contains BOM, while PHP4 and PHP5 do not support BOM.
2. Modify session.auto in php.ini_ Start = 0 is session.auto_ start = 1
3. There is another way to directly give the session_ Start() plus @ session_ Start () will be fine.
4. This information indicates that there is already content output when the session is enabled. You can add ob at the top_ start()。
OB is the abbreviation of output buffering. If ob is used correctly, it can accelerate the speed of web pages, but blindly adding ob function will only increase the additional burden on the CPU. The basic function of ob
1) . prevent using setcookie, header or session after the browser has output_ Error caused by start function.
2) . capture the output of some unavailable functions. For example, phpinfo will output a lot of HTML, but we can’t use a variable, such as $info = phpinfo(); To capture, and then ob it works.
3) . process the output content, such as gzip compression, simple and complex conversion, such as string replacement.
4) Generating a static file is actually capturing the output of the whole page and saving it as a file. It is often used in generating HTML or whole page cache.
five Add the code of shielding warning error directly to the header of PHP file:
// If there is a session_ Star() in session_ After star()
// Your PHP code
- Session_start(): Cannot start session when headers already sent in [How to Solve]
- Solve undefined variable:_ The method of session
- Ajax submitting datagram in firebox_ ERROR_ DOCUMENT_ NOT_ Cached error
- What does HTTP status code 304 mean
- [Solved] Python request Error: requests.exceptions.ReadTimeout: HTTPSConnectionPool (xxxx)
- Provisional headers are shown
- Functions of Yum clean all
- Call JIRA API to create issue prompt xsrf check failed
- xhr.js:108 Refused to set unsafe header “Cookie”
- The solution of ‘STR’ object has no attribute ‘get’ error