PHP 自定义 alert 跳转方法

    /**
     * 跳转方法
     * @param $msg
     * @param null $path
     * @param null $parent
     */
    public function alert($msg,$path=NULL,$parent=NULL){
        if($parent === true){
            $str=<<<str
        <script>alert('{$msg}');parent.location.href='{$path}'</script>
str;
        }else if(empty($path)){
            $str=<<<str
        <script>alert('{$msg}');history.back()</script>
str;
        }else{
            $str=<<<str
        <script>alert('{$msg}');location.href='{$path}'</script>
str;
        };
        echo $str;
    }
原文地址:https://www.cnblogs.com/ningjiabing/p/10066093.html