- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Redirection in PHP
The header function in PHP can be used to redirect the user from one page to another. It is an in-built function that sends raw HTTP header to the destination (client).
Syntax of header function
header( $header_value, $replace_value, $http_response_code)
Following are the parameters −
- The ‘header_value’ in the function is used to store the header string.
- The ‘replace_value’ parameter stores the value that needs to be replaced.
- The ‘response_code’ is used to store the HTTP response code.
Example
<?php header("Location: http://www.tutorialspoint.com"); exit; ?>
The website to which the page needs to be redirected is specified in the header function.
Advertisements