问题描述
我使用的是 codeigniter 2.1.4
I am using codeigniter 2.1.4
因为我使用 form_validation
库进行表单验证.
In that I am using form_validation
library for form validation.
当我尝试运行该函数时出现以下错误
When I try to run that function I get following error
无法加载请求的语言文件:language/en/form_validation_lang.php
我已经扫描了所有文件.我仍然没有在任何文件中使用或调用此语言文件,并且出现此错误.
I have scanned all of the files. I am not using or calling this language file in any file still and I am getting this error.
function insert(){
$this->load->library('form_validation');
$this->form_validation->set_rules('username_field', 'username', 'required');
$this->form_validation->set_rules('firstname_field', 'firstname', 'required');
$this->form_validation->set_rules('lastname_field', 'lastname', 'required');
$this->form_validation->set_rules('email_field', 'email', 'required|valid_email|callback_isEmailExist');
if ($this->form_validation->run() == FALSE) {
$this->create();
}
}
function isEmailExist($email) {
$this->load->library('form_validation');
$is_exist = $this->users->isEmailExist($email);
if ($is_exist) {
$this->form_validation->set_message(
'isEmailExist', 'Email address is already exist.'
);
return false;
} else {
return true;
}
}
对此有什么解决方案?
推荐答案
CI form_validation
library uses language file for display error message.You are using required
valid_email
那些错误信息写在form_validation_lang.php
中.
CI form_validation
library uses language file for display error message.You are using required
valid_email
those error message is written inside form_validation_lang.php
.
form_validation
库自己加载语言文件(form_validation_lang.php
),不管你是否加载.你可以打开库文件,看看你会看到的运行函数一行 $this->CI->lang->load('form_validation');
form_validation
library loads the language file(form_validation_lang.php
) itself whether you load or not.You can open the library file and look at the run function you will see a line $this->CI->lang->load('form_validation');
此文件位于您的system/language/your_language/
或application/language/your_language/
中.
This file located either inside your system/language/your_language/
or application/language/your_language/
.
该错误消息表明您错过了任何文件夹中的文件.如果您下载原始 CI 文件,它应该位于 system/language/english/
文件夹中.如果您没有看到文件 download CI 并在那里恢复文件.
That error message says you missed the file inside any of the folder.If you download the original CI files it should be inside system/language/english/
folder.If you don't see the file download CI and restore the file there.
这篇关于无法加载请求的语言文件:language/en/form_validation_lang.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!