FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge branch 'master' of git.chelun.com:swoole/framework · onejson/framework@6ac9cdb · GitHub

Repository navigation

Commit 6ac9cdb

Browse files
root
committed
Merge branch 'master' of git.chelun.com:swoole/framework
2 parents 578d815 + 04b465d commit 6ac9cdb

11 files changed

Lines changed: 146 additions & 176 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@ SwooleFramework: PHP的高级开发框架
3737

3838
在线体验地址:<http://www.swoole.com/page/index/>
3939

40-
赞助Swoole开源项目(支付宝)
41-
-----
42-
![捐赠Swoole开源项目](http://wiki.swoole.com/static/image/alipay.png)
43-
44-
Composer
45-
-----
46-
```js
47-
{
48-
"require": {
49-
"matyhtf/swoole_framework": "dev-master"
50-
}
51-
}
52-
```
53-
5440
SwooleFramework应用服务器,需要安装swoole扩展。
5541
```
5642
pecl install swoole

‎apps/configs/session.php‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
2-
/**
3-
* Created by PhpStorm.
4-
* User: htf
5-
* Date: 14-6-7
6-
* Time: 上午11:09
7-
*/
2+
return array(
3+
//cache.php配置中必须有session一项
4+
'cache_id' => 'session',
5+
'use_php_session' => false,
6+
'session_lifetime' => 0,
7+
//'cookie_domain' => 'framework.com',
8+
'cookie_lifetime' => 86400000,
9+
);

‎apps/controllers/Session.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function write()
99
//使用此函数代替PHP的session_start
1010
$this->session->start();
1111
$_SESSION['test'] = 1;
12+
echo "ok";
1213
}
1314

1415
function read()

‎libs/Swoole/Auth.php‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ function logout()
216216
}
217217
unset($_SESSION[self::$session_prefix . 'isLogin']);
218218
unset($_SESSION[self::$session_prefix . 'user_id']);
219-
220219
if (!empty($_SESSION[self::$session_prefix . 'save_key']))
221220
{
222221
foreach ($_SESSION[self::$session_prefix . 'save_key'] as $sk)
@@ -225,10 +224,6 @@ function logout()
225224
}
226225
}
227226
unset($_SESSION[self::$session_prefix . 'save_key']);
228-
if (isset($_COOKIE[self::$session_prefix . 'password']))
229-
{
230-
Cookie::set(self::$session_prefix . 'password', '', 0, '/');
231-
}
232227
return true;
233228
}
234229

‎libs/Swoole/Http/LAMP.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
namespace Swoole\Http;
33

44
use Swoole\IFace\Http;
5-
use Swoole\Response;
5+
use Swoole;
66

77
class LAMP implements Http
88
{
@@ -13,7 +13,7 @@ function header($k,$v)
1313

1414
function status($code)
1515
{
16-
header('HTTP/1.1 '. Response::$HTTP_HEADERS[$code]);
16+
header('HTTP/1.1 '. Swoole\Response::$HTTP_HEADERS[$code]);
1717
}
1818

1919
function response($content)
@@ -23,7 +23,7 @@ function response($content)
2323

2424
function redirect($url, $mode = 302)
2525
{
26-
header("HTTP/1.1 " . Response::$HTTP_HEADERS[$mode]);
26+
header("HTTP/1.1 " . Swoole\Response::$HTTP_HEADERS[$mode]);
2727
header("Location: " . $url);
2828
}
2929

‎libs/Swoole/Pager.php‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,21 @@ function __construct($array)
5353
{
5454
Error::info(__FUNCTION__, 'need a param of total');
5555
}
56-
5756
$total = intval($array['total']);
57+
/**
58+
* 兼容不同的Key写法
59+
*/
60+
if (isset($array['pagesize']))
61+
{
62+
$array['perpage'] = intval($array['pagesize']);
63+
}
64+
if (isset($array['page']))
65+
{
66+
$array['nowindex'] = intval($array['page']);
67+
}
68+
//每页多少条
5869
$perpage = isset($array['perpage']) ? intval($array['perpage']) : 10;
70+
//当前页数
5971
$nowindex = isset($array['nowindex']) ? intval($array['nowindex']) : '';
6072
$url = isset($array['url']) ? $array['url'] : '';
6173
}

‎libs/Swoole/Protocol/AppServer.php‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ function onStart($serv)
3434
{
3535
$php->tpl->clear_all_assign();
3636
}
37-
//还原session
38-
if (!empty($php->session))
39-
{
40-
$php->session->open = false;
41-
$php->session->readonly = false;
42-
}
4337
});
4438
}
4539

@@ -52,4 +46,4 @@ function onRequest(Swoole\Request $request)
5246
{
5347
return Swoole::getInstance()->handlerServer($request);
5448
}
55-
}
49+
}

‎libs/Swoole/Request.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ function download($mime, $filename)
118118
*/
119119
function getClientIP()
120120
{
121+
if (isset($this->server["HTTP_X_REAL_IP"]) and strcasecmp($this->server["HTTP_X_REAL_IP"], "unknown"))
122+
{
123+
return $this->server["HTTP_X_REAL_IP"];
124+
}
121125
if (isset($this->server["HTTP_CLIENT_IP"]) and strcasecmp($this->server["HTTP_CLIENT_IP"], "unknown"))
122126
{
123127
return $this->server["HTTP_CLIENT_IP"];

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL