This tutorial is to call the static method of the static tool class to complete the pop-up window jump function
1, encapsulate the pop-up window jump Transfer method
Create tool class Tool.class.php
##The code is as follows:
<?php /** * Created by PhpStorm. * User: Administrator * Date: 2018/3/3 0003 * Time: 下午 1:56 */ class Tool{ //执行某个方法成功并需要跳转到指定页面时使用 public static function skipPage($info,$url){ echo "<script>alert('$info');location.href='$url';</script>"; exit(); } //某个操作执行失败时调用 public static function returnPage($info){ echo "<script>alert('$info');history.back();</script>"; } }
2, Calling the tool class
Directly call the skipPage() method in the Tool class when you need to jump to other pages in the future Just use the returnPage() method