自定义 打印 成功跳转 失败返回 函数

/**
 * 自定义打印函数
 
*/
function p ($arr) {
    echo "<pre>";
    print_r($arr);
    echo "</pre>";
}

/**
 * 成功跳转函数
 
*/

function success ($url, $msg) {
    header('Content-Type:text/html;charset=utf-8');
    $url = site_url($url);   //ci框架
    echo "<script type='text/javascript'>alert('$msg');location.href='$url'</script>";
    die;
}

/**
 * 失败返回函数
 
*/

function error ($msg) {
    header('Content-Type:text/html;charset=utf-8');
    echo "<script type='text/javascript'>alert('$msg');window.history.back();</script>";
    die;
}
原文地址:https://www.cnblogs.com/qhorse/p/4589190.html