Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
system
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
_site-res
system
Commits
8d59dd6f
Commit
8d59dd6f
authored
Jun 15, 2018
by
tufengqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增TPHPSTEAM自定义类
parent
84c265e4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
TPhpStream.php
classes/fpf/thrift/TPhpStream.php
+18
-7
No files found.
classes/fpf/thrift/TPhpStream.php
View file @
8d59dd6f
...
...
@@ -44,20 +44,32 @@ class TPhpStream extends TTransport
private
$write_
=
false
;
private
static
$fd
;
public
function
__construct
(
$mode
)
{
$this
->
read_
=
$mode
&
self
::
MODE_R
;
$this
->
write_
=
$mode
&
self
::
MODE_W
;
}
public
function
setContent
(
$HTTP_RAW_POST_DATA
){
public
static
function
getFd
()
{
return
self
::
$fd
;
}
public
static
function
setFd
(
$fd
)
{
self
::
$fd
=
$fd
;
}
public
function
open
()
{
if
(
$this
->
read_
&&
!
defined
(
'IS_SWOOLE_SERVICE'
))
{
if
(
$this
->
read_
)
{
if
(
defined
(
'IS_SWOOLE_SERVICE'
)
&&
true
===
IS_SWOOLE_SERVICE
)
{
$this
->
inStream_
=
self
::
$fd
;
}
else
{
$this
->
inStream_
=
@
fopen
(
self
::
inStreamName
(),
'r'
);
}
if
(
!
is_resource
(
$this
->
inStream_
))
{
throw
new
TException
(
'TPhpStream: Could not open php://input'
);
}
...
...
@@ -72,7 +84,7 @@ class TPhpStream extends TTransport
public
function
close
()
{
if
(
$this
->
read_
&&
!
defined
(
'IS_SWOOLE_SERVICE'
)
)
{
if
(
$this
->
read_
)
{
@
fclose
(
$this
->
inStream_
);
$this
->
inStream_
=
null
;
}
...
...
@@ -89,9 +101,6 @@ class TPhpStream extends TTransport
public
function
read
(
$len
)
{
if
(
defined
(
'IS_SWOOLE_SERVICE'
)
&&
true
===
IS_SWOOLE_SERVICE
)
{
subStr
();
}
$data
=
@
fread
(
$this
->
inStream_
,
$len
);
if
(
$data
===
false
||
$data
===
''
)
{
throw
new
TException
(
'TPhpStream: Could not read '
.
$len
.
' bytes'
);
...
...
@@ -121,9 +130,11 @@ class TPhpStream extends TTransport
private
static
function
inStreamName
()
{
if
(
php_sapi_name
()
==
'cli'
)
{
if
(
defined
(
'IS_SWOOLE_SERVICE'
)
&&
true
===
IS_SWOOLE_SERVICE
)
{
return
'php://temp'
;
}
return
'php://stdin'
;
}
return
'php://input'
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment