Home > Article > Backend Development > java - When executing a function in php, how to automatically call a link address within the function
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
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
Use header function
<code class="php">header("Location: https://post.zz173.com",true,301); //确保重定向后,后续代码不会被执行 exit;</code>
Write meta tag
<code class="html"><meta http-equiv="refresh" content="1;url=https://post.zz173.com"> </code>
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>
header
That’s the method. Try it
<code>header("Location:b.php"); exit();</code>