Static tool class
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{ //執(zhí)行某個方法成功并需要跳轉(zhuǎn)到指定頁面時使用 public static function skipPage($info,$url){ echo "<script>alert('$info');location.href='$url';</script>"; exit(); } //某個操作執(zhí)行失敗時調(diào)用 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