我的codeignitor应用程序出错:
无法加载请求的文件:helpers / files_helper.php
请您详细说明问题在哪里?
文件:autoload.php
<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array( 'database', 'user_agent', 'image_lib', 'encryption', 'object_cache', 'email', 'app', 'gateways/app_gateway', 'sms' );
$CI = &get_instance();
$CI->load->helper('files');
$gateways = list_files(APPPATH.'/libraries/gateways');
foreach ($gateways as $gateway) {
$pathinfo = pathinfo($gateway);
// Check if file is .php and do not starts with .dot
// Offen happens Mac os user to have underscore prefixed files while unzipping the zip file.
if ($pathinfo['extension'] == 'php' && 0 !== strpos($gateway, '.') && $pathinfo['filename'] != 'App_gateway') {
array_push($autoload['libraries'], 'gateways/'.strtolower($pathinfo['filename']));
}
}
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
*/
$autoload['drivers'] = array('session');
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array(
'url',
'file',
'form',
'action_hooks',
'general',
'misc',
'func',
'datatables',
'custom_fields',
'defaults',
'merge_fields',
'app_html',
'email_templates',
'invoices',
'estimates',
'credit_notes',
'proposals',
'projects',
'tasks',
'fields',
'tickets',
'relation',
'tags',
'pdf',
'clients',
'database',
'upload',
'sales',
'themes',
'theme_style',
'pre_query_data_formatters',
'widgets',
'sms',
'deprecated',
);
if (file_exists(APPPATH.'helpers/system_messages_helper.php')) {
array_push($autoload['helper'], 'system_messages');
}
if (file_exists(APPPATH.'helpers/my_functions_helper.php')) {
array_push($autoload['helper'], 'my_functions');
}
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array('english');
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array( 'misc_model' , 'roles_model' , 'clients_model' , 'tasks_model' );
if(file_exists(APPPATH.'config/my_autoload.php')){
include_once(APPPATH.'config/my_autoload.php');
}
此文件的codeigitor应用程序中的路径是application / config / autoload.php 我只想尝试从基本网址登录:http://crm.thecoder.pw/ 我收到此错误:无法加载请求的文件:helpers / files_helper.php
答案 0 :(得分:3)
没有帮助电话files_helper
。使用file
$this->load->helper('file');
$autoload['helper'] = array('file');
编辑01
如果您要创建新的帮助,请检查 this answer as well
答案 1 :(得分:1)
我认为你已经在application / helpers文件夹中创建了帮助器
您必须在 system / helpers 文件夹中创建帮助程序,而不是 application / helpers 。
然后加载$this->load->helper('files');
答案 2 :(得分:0)
我认为这是您犯下的一个简单错误,请在代码的下方替换
$CI->load->helper('files');
通过
$CI->load->helper('file');
答案 3 :(得分:0)
我的解决方案是将custom_helper.php
从application/helpers/custom_helper.php
中移出
到system/helpers/custom_helper.php
和application/config/autoload.php $autoload['helper'] = array('custom');
重新加载页面,效果很好
答案 4 :(得分:0)
助手名称中不应使用大写字母。