开发者

Code Igniter email config to config.php

I've put my email configurations in the config.php but I don't know how I can access them in my controller.

In my config.php:

/*EMAIL CONFIG*/
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.开发者_JAVA技巧googlemail.com';
$config['smtp_user'] = 'username';
$config['smtp_pass'] = 'pass';
$config['smtp_port'] = '465';
$config['mailtype'] = 'html';

Should I make an instance of the super global object?

Thanks in advance.


You don't put email config settings in config.php. You make a new file called email.php and place it in the config folder. CI will automatically detect the email config setting from that file.

Look under "Setting Email Preferences in a Config File"

http://ellislab.com/codeigniter/user-guide/libraries/email.html


You can access it with:

$this->config->item('protocol');

Also, see the relevant chapter in CodeIgniter User Guide

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜