Skip to content

Commit 3c6cab2

Browse files
committed
session examples
1 parent 41fc57e commit 3c6cab2

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

apps/configs/cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
$cache['session'] = array(
3-
'type' => 'FileCache',
3+
'type' => 'FileCache',
44
);
55
$cache['master'] = array(
66
'type' => 'Memcache',

apps/controllers/page.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ function tpl_test()
4242
$this->tpl->display('tpl_test.html');
4343
}
4444

45+
function session_test()
46+
{
47+
$this->session->start();
48+
$_SESSION['hello'] = 'swoole';
49+
}
50+
51+
function session_read()
52+
{
53+
$this->session->start();
54+
var_dump($_SESSION);
55+
}
56+
4557
//使用php直接作为模板
4658
function view_test()
4759
{

libs/Swoole/Database.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ function rollback()
121121
/**
122122
* 执行一条SQL语句
123123
* @param $sql
124-
* @return unknown_type
125124
*/
126125
public function query($sql)
127126
{

libs/Swoole/SelectDB.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,12 @@ public function count()
546546
{
547547
$cc+=$_c['c'];
548548
}
549-
return $cc;
549+
return intval($cc);
550550
}
551551
else
552552
{
553553
$c = $this->db->query($sql)->fetch();
554-
return $c['c'];
554+
return intval($c['c']);
555555
}
556556
}
557557
/**

0 commit comments

Comments
 (0)