Where to place global functions in codeigniter

前端 未结 4 1544
误落风尘
误落风尘 2020-12-14 02:15

I have created a few utility functions like one h() that acts as echo htmlentities($var) . I want theses functions to be available everywhere . so

4条回答
  •  囚心锁ツ
    2020-12-14 02:41

    Use codeigniter-kint and a custom file for global Functions. This will give you a more helpful and beautiful Output like: enter image description here

    File: application/helpers/globalfunctions_helper.php

    load->library('kint');
           return @Kint::dump($value);   
          }
        }
        if(!function_exists('dp')){
          function dp($value=false)
          {
           $CI = get_instance();
           $CI->load->library('kint');
           Kint::dump($value);
           die();
          }
        }
    

    See also: http://raveren.github.io/kint/

提交回复
热议问题