kohana::config('file')->get('key')
每个module中都可以有个config配置文件夹,这里面可以放一些常用的配置数据。调用也很方便。
如:
modules\manage\config\notices.php
文件名随意,调用时指定即可。
内容:
<?php defined('SYSPATH') or die('No direct script access.');
return array(
'manage' => array(
'create' => array(
'help_text' => 'When a new ver is created.'
),
'reschedule' => array(
'help_text' => 'When a ver is rescheduled.'
),
'relocate' => array(
'help_text' => 'When a venue for an ver changes.'
),
'reminder' => array(
'help_text' => 'Reminding the user about the ver 1 day ago.'
),
'hotid' => array(20, 19),
),
'verresult' => array(
'declare' => array(
'help_text' => 'When results for an ver are declared.'
),
),
);
调用:
function action_a()
{
$ary = Kohana::config('notices')->get('manage');
print_r($ary['hotid']);
exit();
}