What is the equivalent function of window.location.href of JavaScript in PHP? [duplicate]

4

I want to redirect the visitor to another page so I wanted the equivalent of window.location.href in PHP

    
asked by anonymous 02.10.2015 / 16:15

1 answer

6

Use the header .

header("Location: http://www.linkDoSite.com/");
exit();

According to the function documentation, it must be run before any output is sent. This includes any HTML, plain text, blank lines, spaces or exits of PHP itself.

    
02.10.2015 / 16:16