Index.php
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use Action\WebAction;
use Index\HomeModel;
use WebPlugin\Helpers;
/**
* 默认控制器
*/
class IndexController extends WebAction
{
/**
* 男生首页
*/
public function indexAction()
{
// 判断是不是女生
$channel = Helpers::getChannelNameByCookie();
if ($channel === 'girls') {
$this->go(Helpers::url('/woman'));
} else {
// 设置客户端浏览器1分钟内不改变
$this->setLastModified(mktime(date('H'), date('i'), 0, date('n'), date('j'), date('Y')));
// 设置浏览器缓存1分钟
$this->setExpires(60);
}
// 传递模板数据,渲染模板
$this->setWebNavHeader(HomeModel::COOKIE_NAME_BOYS);
$data = array(
'boysHomePage' => true,
'footerTop'=> true,
'boys' => HomeModel::getChannelResource(HomeModel::COOKIE_NAME_BOYS, HomeModel::CODE_BOYS_CHANNEL)
);
$this->_view->display('index', $data);
}
}