The Archives

設定 Kohana 透過 Gmail 發信

有了之前設定 CodeIgniter 透過 Gmail 發信的經驗, 這次設定 Kohana 就快很多了 :p
不過 CodeIgniter 是 email library, 而 Kohana 則是 email helper (實際上是使用 swift mailer)。
設定檔 /application/config/email.php

$config['driver'] = ’smtp’;
$config['options'] = array(
‘hostname’ => ’smtp.gmail.com’,
‘username’ => ‘your_username’,
‘password’ => ‘your_password’,
‘port’ => 465,
‘encryption’ => [...]

The ORM find_by_* method is gone. (Kohana 2.2)

According to this post in the kohana forum, the find_by_* method of ORM is not avaliable since Kohana 2.2 because the performance issue.
In the previous version, Kohana 2.1.2, I used before. I can use find_by_*() method like this:

$user = new User_Model();
$user->find_by_username(’tzangms’);

But for now, in Kohana 2.2, we should use where() instead, if we want to [...]

Kohana 2.2 Session problem (filter extension needed)

I encountered a problem with Kohana session library last night, here is the error message below:
Use of undefined constant FILTER_FLAG_NO_PRIV_RANGE - assumed ‘FILTER_FLAG_NO_PRIV_RANGE’
It means that PHP has to enable filter extension. But the document doesn’t mention this at all.
Anyway, I am recompiling PHP with USE=’filter’. Orz