Вопрос

I Learning a framework Kohana.

What is difference between Kohana::message and Kohana::config?

They perform the same function. Maybe if there is a difference between the concept?

Это было полезно?

Решение

Kohana:message

These are generally used to store messages that will be displayed to the user. For example if you have a method that tries to create a user and it fails, you can get the relevant you can you may have the following in a User Controller:

$create = $this->create_user($user);

if($create)
{
    // user created
    $message = Kohana::message('user', 'create_success');
}
else
{
    // failed to create user
    $message = Kohana::message('user', 'create_error');
}

Kohana:config

This is used for configuration information such as the hash_method used in auth module and you can access it using Kohana::$config->load('auth.hash_method')

Другие советы

One is for configuration information. The other is for reusable text: Kohana::message('registration.error.email') could say something like "There is already an account using the email address you entered, an email with instruction on how to reset you password has been sent in case you forgot it.".

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top