Home  >  Article  >  Backend Development  >  java - When executing a function in php, how to automatically call a link address within the function

java - When executing a function in php, how to automatically call a link address within the function

WBOY
WBOYOriginal
2016-07-06 13:53:431024browse

For example, if I execute the show() method in a.php, I want to jump to b.php after the function is executed. There is window.location.href in JS. What should I use in php? I forgot

Reply content:

For example, if I execute the show() method in a.php, I want to jump to b.php after the function is executed. There is window.location.href in JS. What should I use in php? I forgot

  1. Use header function

    <code class="php">header("Location: https://post.zz173.com",true,301); 
    //确保重定向后,后续代码不会被执行 
    exit;</code>
  2. Write meta tag

    <code class="html"><meta http-equiv="refresh" 
    content="1;url=https://post.zz173.com"> </code>
  3. Write javascript tag

    <code class="php"><php?
    echo "< script language='javascript' 
    type='text/javascript'>";  
    echo "window.location.href='https://post.zz173.com'";  
    echo "< /script>";  </code>

headerThat’s the method. Try it

<code>header("Location:b.php"); exit();</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn