how to require_once in codeigniter

流过昼夜 提交于 2019-11-28 08:21:11

Use CodeIgniter's built in constant, APPPATH

require_once(APPPATH.'libraries/ion_auth.php');

If the library is a codeigniter specific library, as sbaaaang points out, you should use:

$this->load->library('ion_auth');

However, if the library is just a generic PHP class or set of functions, the codeiginter loader may not recognize it. Then you will need to use either one of the generic loading operators (include, include_once, require, require_once), with the APPPATH constant, as also pointed out:

require_once(APPPATH.'libraries/ion_auth.php');

In a real server, you should use library's UPPERCASE name. like this:

require_once(APPPATH.'libraries/Ion_auth.php');

Do you know that Codeigniter has a loader class?

change this

require_once('/home/SITE_NAME/public_html/FOLDER_NAME/application/libraries/ion_auth.php')

to

$this->load->library('ion_auth');

and be sure your libraries/ion_auth.php file it's a class named `class ion_auth{}`
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!