What is the difference between http-equiv implementation jump and header jump? Or is there no difference between the two

  question

<? Php


session_start(); if(isset($_SESSION['userId'],$_SESSION['name'],$_SESSION['rights'])){ echo "<meta http-equiv=\"refresh\" content=\"0; url=mannager.php\">"; bracket else{ echo "<meta http-equiv=\"refresh\" content=\"0; url=login.php\">"; bracket

As above code, what is the difference between this and header implementation jump?

The difference is:

Meta redirect can be applied to situations where http headers have already been sent out. For example, a web page has already been rendered in half but has to jump. Another advantage is that it can delay jump.

Header redirect is to jump before http headers are sent, for example, jump as soon as a web page is opened before rendering. Use this timeheader("Location: url", $status_code)You can also add the status code, but the former cannot.

I prefer header, using meta redirect, occasionally encountered jump failed, blank. header redirect can add status_code, for seo is better.

Like your code, use header.session_start();Only when http headers have not been sent can the call succeed.

If you must use meta redirect, it is recommended to add one after it.exit;


If you think about it carefully, there is nothing to compare one on the server and the other on the browser: [