非常简单的一个demo,需要实现提示并跳转,主要页面要求不高,觉得没必要使用AJAX,JS等。
于是研究了一下在PHP提示并跳转。
开始使用如下跳转:
echo "<script> alert('sucess');parent.location.href='/user/index'; </script>";
alert里面是提示的消息,href是提示后跳转的页面。
后来想起TP框架里面有个redirect()重定向的方法,就去看了看。
不过TP自带的不是弹出窗,于是修改为:
$url="http://www.jbxue.com";
echo "<script> alert('no loginid'); </script>";
<em id="__mceDel">echo "<meta http-equiv='Refresh' content='0;URL=$url'>";</em>
$url就是要跳转的页面,同时,这个还能控制跳转时间,content后面的0就是表示0秒后跳转。
两个直接跳转的方式:
header("Location:".PSYS_BASE_URL."user/index"); 和 header("refresh:{$time};url={$url}");
这两种方式无提示,直接跳转。推荐下面一种。
最后还有一个问题,跳转代码后都跟上一个 return,因为还会执行后面的语句。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

SublimeText3 Linux new version
SublimeText3 Linux latest version
