Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution of sessionstart error reporting in php

Shulou Source: shulou.com Published: 2022-06-03 20:23:13 11月12日 Update

This article will explain in detail the solution to the error report of sessionstart in php. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Php session start reports an error because there is output before the function is executed. The solution is: 1, create a PHP sample file; 2, add "ob_start ();" before "session_start ()".

Operating environment of this article: Windows7 system, PHP7.1 version, Dell G3 computer

What if I report an error in php session start?

Cause Analysis and solution of error in php session_start ()

Error message: Warning: session_start () [function.session-start]: Cannot send session cache limiter-headers already sent

Reason: if there is an output before session_start (), there will be an error

Solution: add ob_start () before session_start ()

Index.php

The code is as follows:

Index2

Index2.Php

The code is as follows:

This is the end of index's article on "the solution to sessionstart error reporting in php". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Method content article code method reason more output good practical function cause analysis how to do file article version environment computer knowledge example Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi NVidia Apple vpn