Home > Backend Development > PHP Tutorial > 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
Release: 2016-07-06 13:53:43
Original
1054 people have browsed it

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>
    Copy after login
  2. Write meta tag

    <code class="html"><meta http-equiv="refresh" 
    content="1;url=https://post.zz173.com"> </code>
    Copy after login
  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>
    Copy after login

headerThat’s the method. Try it

<code>header("Location:b.php"); exit();</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template