DLR Posted April 7, 2010 Share Posted April 7, 2010 Hi, this simple function does not work when ob_end_clean() is included. function get_header($path,$file) { ob_start(); include ($path.$file); $var = ob_get_contents(); //file contents are stored in $var so now we try to clean output buffer ob_end_clean(); // this stops the script from working - why? // and if I leave it out and add it at the very end of the script it also stops the whole script from working! why? // and if I leave it out alltogether the script seems to work fine!!!! (but the buffer will keep building up with succesive calls to this function - and must surely create a problem somewhere) return $var; } get_header("../client_info/",$_SESSION['header']); Link to comment https://forums.phpfreaks.com/topic/197922-at-my-wits-end-can-you-help-solve-this-ob_startob_end_clean-puzzle/ Share on other sites More sharing options...
premiso Posted April 7, 2010 Share Posted April 7, 2010 I am not sure why, you would have to turn on error reporting and see what errors come. You can also try this instead: function get_header($path, $file) { ob_start(); include($path . $file); return ob_get_clean(); } get_header("../client_info/", $_SESSION['header']); If that does not work, yea turn on error displaying and make sure that error_reporting is set to E_ALL and see what error is coming up. Link to comment https://forums.phpfreaks.com/topic/197922-at-my-wits-end-can-you-help-solve-this-ob_startob_end_clean-puzzle/#findComment-1038610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.