无法加载请求的语言文件:language / en / form_validation_lang.php [英] Unable to load the requested language file: language/en/form_validation_lang.php

查看:1184
本文介绍了无法加载请求的语言文件:language / en / form_validation_lang.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用codeigniter 2.1.4



因为我使用 form_validation 库进行表单验证。 / p>

当我尝试运行该函数时,会出现以下错误




无法加载请求的语言文件:language / en / form_validation_lang.php


我已扫描所有文件。我不是在任何文件中仍然使用或调用这个语言文件,我得到这个错误。

  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','电子邮件地址已存在'。
) ;
return false;
} else {
return true;
}
}

这是什么解决方案?

解决方案

CI form_validation 库使用语言文件显示错误消息。您正在使用 required valid_email 那些错误消息写在 form_validation_lang.php / p>

form_validation 库加载语言文件( form_validation_lang.php )本身,无论你是否加载。你可以打开库文件,看看运行函数你会看到一行 $ this-> CI-> lang-> load('form_validation') ;



此文件位于 system / language / your_language / code> application / language / your_language /



那个错误信息说你错过了任何文件夹中的文件。下载原始CI文件,它应该在 system / language / english / 文件夹中。如果您看不到文件下载 CI并在那里恢复该文件。


I am using codeigniter 2.1.4

In that I am using form_validation library for form validation.

When I try to run that function I get following error

Unable to load the requested language file: 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;
    }
}

What is the solution for this?

解决方案

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 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');

This file located either inside your system/language/your_language/ or application/language/your_language/.

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆