Public functions in CodeIgniter cannot be appended and can be implemented through helper auxiliary functions.
Create the common_helper.php file, define the required public functions, and store it in the application/helpers directory.
Configure $autoload['helper'] = array('common'); in application/config/autoload.php.
Global variables can also be implemented with helper functions. However, a more appropriate way may be to use configuration class definition .
CodeIgniter has a main configuration file by default, located in the application/config/config.php path, which defines a bunch of framework-level global configurations, an array named $config.
If you need to add global configuration items, you can do so in this file. Considering the separation of custom configuration and framework configuration, it is recommended to create a new file vars.php, and then define it as follows:
$src = $this->config->item('src');
$cache = $src['cache']
or: