zoukankan      html  css  js  c++  java
  • CI 笔记,借鉴的4个辅助自定义函数

    在System的core的common.php中,借鉴的4个自定义函数,

    摘自后盾网的CI教程

    /**
     * 格式化打印函数
     * @param  [type] $arr [数组]
     * @return [type]      [description]
     */
    function p($arr){
        echo '<pre>';
        print_r($arr);
        echo '</pre>';
    }
    // admin/category/index
    /**
     * 成功提示函数
     * @param  [type] $url [跳转地址]
     * @param  [type] $msg [提示信息]
     * @return [type]      [description]
     */
    function success($url, $msg){
        header('Content-Type:text/html;charset=utf-8');
        $url = site_url($url);
        echo "<script type='text/javascript'>alert('$msg');location.href='$url'</script>";
        die;
    }
    
    /**
     * 错误提示函数
     * @param  [type] $msg [提示信息]
     * @return [type]      [description]
     */
    function error($msg){
        header('Content-Type:text/html;charset=utf-8');
        echo "<script type='text/javascript'>alert('$msg');window.history.back();</script>";
        die;
    }
    
    
    /**
     * 打印常量
     */
    function print_const(){
        $const = get_defined_constants(TRUE);
        p($const['user']);    
    }
  • 相关阅读:
    大整数乘除法
    java大神进阶之路
    自定义Swap
    指针基础详解
    已知前序中序求后序(转载)
    杭电1003_Max Sum
    回溯法求解迷宫问题
    linux下安装QQ等EXE文件
    java工程中使用freemarker例子
    maven自动部署到tomcat的问题
  • 原文地址:https://www.cnblogs.com/sdgtxuyong/p/5486163.html
Copyright © 2011-2022 走看看