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>

 

posted @ 2019-11-24 11:33  Ryan_zheng  阅读(1661)  评论(0编辑  收藏  举报