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住房公积金管理系统---长春工业大学期末实训
    11.6_Filter
    11.5_Listener
    11.4_Ajax & Jquery
    11.3_MVC设计模式
    11.2_数据库连接池&DBUtils
    11.1_事物
    10.7_JSP & EL & JSTL
    10.6_Cookie&Session
  • 原文地址:https://www.cnblogs.com/sdgtxuyong/p/5486163.html
Copyright © 2011-2022 走看看