1、创建类文件
2、构造函数中使用数组形参,接收传递参数
class Hehe { // ------------------------------------------------------------------------ public function __construct($config = array()) { p($config); } // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ public function index() { // } function tst() { p(333); } // ------------------------------------------------------------------------ }
3、调用类库
function add() { $data = array( 'aa' => 11, 'bb' => 22 ); $this->load->library('hehe', $data); }
标签:类库,function,自定义,CI3,array,config,----------------------------------------------- From: https://www.cnblogs.com/haokan/p/18384693