문제

I have a php server script that loops through session id's, and checks their values, and I'd like to output text for debugging reasons, but I get the 'Headers already sent' error (Which is expected) ... So I was wondering if there was a way to output text without sending headers ... This may be the stupidest question I've ever asked, but hey Lol

도움이 되었습니까?

해결책

You could use the ob_start function, which starts output buffering and which will result in the header function not throwing the error message.

You could also use a file (file_put_contents).

Or like Collin Grady said: If it's just for debugging, ignore the warnings, read the information you need and remove the debug prints again.

다른 팁

You're getting that error because you're sending a header later in the file. If you only need the debugging info and don't care about the rest of the script running, just exit; after you print your debug info; this will terminate the script right there, allowing you to see the debug info without your later header() calls triggering an error.

ob_start() will be helpful.

You can also check this http://phpdebugbar.com/ generally for debug :-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top