xyn Posted August 24, 2007 Share Posted August 24, 2007 unless using ob_start [: and it will Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333117 Share on other sites More sharing options...
akitchin Posted August 24, 2007 Share Posted August 24, 2007 that will just spit out the content after running the header(), with the net effect of having a delayed header redirect with no content output between. or, in short, a user going nuts seeing a blank page for 3 seconds. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333120 Share on other sites More sharing options...
xyn Posted August 24, 2007 Share Posted August 24, 2007 i dont test my coding lol. i said from what i knew the three functions do Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333125 Share on other sites More sharing options...
MadTechie Posted August 24, 2007 Share Posted August 24, 2007 unless using ob_start [: and it will erm.. no if you echo after the header.. it will rediect before the display.. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333131 Share on other sites More sharing options...
xyn Posted August 24, 2007 Share Posted August 24, 2007 i dont test my coding lol. i said from what i knew the three functions do you might need to read that Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333137 Share on other sites More sharing options...
AtomicNetwork Posted August 24, 2007 Share Posted August 24, 2007 though you can make header() pause too. aka. echo("chnages saved. you will be redirected..."); sleep(3); // pause for 3 seconds header("location: url"); Nope thats will fail.. nothing can be sent to the screen before a header This is not strictly true, there is an option in php.ini (named output_buffering I believe) that allows you to do such things. So it really is dependent on the server enviroment you are in. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333143 Share on other sites More sharing options...
MadTechie Posted August 24, 2007 Share Posted August 24, 2007 This is not strictly true, there is an option in php.ini (named output_buffering I believe) that allows you to do such things. So it really is dependent on the server enviroment you are in. output_buffering is the size of the buffer for ob_start.. so no it will not work! i dont test my coding lol. i said from what i knew the three functions do you might need to read that i quoted a statement not code the statement also included "it will", thus i corrected you. PS. you should see some of the code i posted for people.. kinda surprised they tried it! lol Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333146 Share on other sites More sharing options...
xyn Posted August 24, 2007 Share Posted August 24, 2007 akichin ccorrected me. anyway irrelivant. like i say i dont know much about headers, just what headers do what job. i knew echo. and sleep.. so i assumed you could match them together :/ i was wrong fair enough. learning curve. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333158 Share on other sites More sharing options...
akitchin Posted August 24, 2007 Share Posted August 24, 2007 just so that everyone is clear on what output buffering does: it does NOT send content before header calls. what it does is captures any browser output made during the script's execution, runs the header() calls when found, and finally FLUSHES that output once the script is done running (or an ob flush routine is called). therefore headers will STILL PRECEDE content output and always will, it will just not send out an error because PHP is "biding its time" so to speak, before it actually outputs to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333202 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 I never used that method with the pause thing before, but works great. Although the data is sent with some missing info in my database, maybe just my code that wrong. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333275 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 I've done a lot of programming and never used output buffering. What's the point in it? It seems to me that it just lets you get away with bad programming practices which is not good... makes the logic hard to follow. Please someone chime in and educate me on a more practical use if there is one. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333304 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 Well, As Long As it Works, then whats the real problem. It would be like you said, bad practice, but its a heck alot better. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333307 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 Support and maintainability. Having obscure things work when they shouldn't makes tracking down problems more difficult. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333327 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 When doing little development for your own stuff or friends maybe this is fine.... when doing it for a client it's not really acceptable to accept that it works, there's more to it than that. You may not be the person who does maintenance in the future so things should be done correctly. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333329 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 It Depends on the situation i guess, and in my case, I will use the META because this is my own stuff... Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333337 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 I wasnt talking about meta... i was talking about output buffering Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333340 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 I know, I just had to say something. Quote Link to comment https://forums.phpfreaks.com/topic/66419-why-header-why-not-meta-refresh/page/2/#findComment-333350 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.