Header menu

_________________________________________________________________________________

Wednesday 18 December 2013

Explain Header() function in php in detail

Header function in php :



<?php header("Location: http://www.codesplanet.blogspot.com/"); ?>

Header function in php is used for redirection to some other page. In simplest form it takes one parameter
the destination url . 

Uses of header() function in php

 

1. The header() function use to sends a raw HTTP header to a client.
2. Use for refresh the page on after given time interval.
3. can be used to send email header content like cc, bcc , reply to etc data and lot more .


What is the Limitation of HEADER()?


In PHP the one and most horrible limitation of HEADER() function is that

header() must be called before all actual outputs .
In other words  header function must be used before any HTML or any echo statement.

                                                                                                                                           

Advance header() function


If you want to redirect after an interval of time then you can use

<?php header('Refresh: 10; URL=http://codesplanet.blogspot.com'); ?>

No comments:

Post a Comment