ci添加公共函数并调用

CodeIgniter 中公共函数可以通过 helper 辅助函数实现。

创建 common_helper.php 文件,定义所需公共函数,存放至 application/helpers 目录中。

在 application/config/autoload.php 中配置 $autoload[‘helper’] = array(‘common’);

 

调用时:

$this->load->helper('common');
verification_phone($data["phone"]);
posted @ 2019-02-17 14:05  yuancr  阅读(449)  评论(0)    收藏  举报