문제

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