首页 > 代码库 > CodeIgniter(3.1.4)框架中成功/错误跳转

CodeIgniter(3.1.4)框架中成功/错误跳转

if ( ! function_exists(‘error‘))
{
    /**
     * 错误跳转
     */
    function error($mes, $url)
    {
        echo ‘<script type="text/javascript">alert("‘.html_escape($mes).‘");history.back();</script>‘;
        exit();
    }
}

// ------------------------------------------------------------------------

if ( ! function_exists(‘success‘))
{
    /**
     * 成功跳转
     */
    function success($mes, $url)
    {
        echo ‘<script type="text/javascript">alert("‘.html_escape($mes).‘");window.location.href="http://www.mamicode.com/‘.$url.‘";</script>‘;
        exit();
    }
}

CodeIgniter(3.1.4)框架中成功/错误跳转