PHP & JS 链接跳转的几种方式

网站开发中,我们经常需要使用链接跳转,比如登录成功后,自动跳转到首页等等,下面方面介绍 PHP & JS 的几种链接跳转方式

PHP

<?php
    header("Location: https://www.ryanzoe.top/");

JS

<script>
window.location = 'https://newurl.com'
</script>

如果想要跳转到同一个网站的不同路径下,可以使用下面的方式

<script>
window.location.pathname = '/new'
</script>

猜你喜欢

转载自www.cnblogs.com/ryanzheng/p/11921712.html
今日推荐