PHP::Session - PowerPoint PPT Presentation

About This Presentation
Title:

PHP::Session

Description:

PHP::Session Tatsuhiko Miyagawa Livin On The EDGE, Co.,Ltd. 2003/01/31 Shibuya.pm Technical Talks PHP::Session ... – PowerPoint PPT presentation

Number of Views:85
Avg rating:3.0/5.0
Slides: 26
Provided by: MIYA4
Learn more at: http://shibuya.pm.org
Category:
Tags: php | mysql | session

less

Transcript and Presenter's Notes

Title: PHP::Session


1
PHPSession
  • Tatsuhiko Miyagawa
  • ltmiyagwa_at_bulknews.netgt
  • Livin On The EDGE, Co.,Ltd.
  • 2003/01/31 Shibuya.pm Technical Talks

2
???
  • PHPSession ??
  • ???????
  • PHP????????
  • PHPSession ???
  • ????
  • ?????

3
PHPSession ??
DESCRIPTION PHPSession provides a way to read /
write PHP4 session files, with which you can make
your Perl Application session shared with
PHP4. PHPSession ? PHP4 ????????????????????????
??????Perl ???????????????PHP4????????????
4
???????
?????????(??
5
????????
  • ???????PHP????????
  • PHP???????
  • ???????????

Perl ?? PHP????????!
6
PHP????????
  • PHP3 ???PHPLIB ?????????????
  • PHP4 ???????????????????????? (PHPLIB?????)
  • ????PHP4???

7
PHP4??????????
  • /tmp/sess_SESSION_ID ??????????????(????????)
  • ????? flock ???
  • ?????????????

bazO3"foo"2s3"bar"s2"ok"s3"yes"s4
"done"arra1i3O3"foo"2s3"bar"s2"o
k"s3"yes"s4"done"!foo
8
???????????
Object
????
???
????
bazO3"foo"2s3"bar"s2"ok"s3"yes"s4
"done"arra1i3O3"foo"2s3"bar"s2"o
k"s3"yes"s4"done"!foo
9
??????????? (cont.)
?
string
??
string
??
?
bazO3"foo"2s3"bar"s2"ok"s3"yes"s4
"done"arra1i3O3"foo"2s3"bar"s2"o
k"s3"yes"s4"done"!foo
10
??????????? (cont.)
???
array
int
bazO3"foo"2s3"bar"s2"ok"s3"yes"s4
"done"arra1i3O3"foo"2s3"bar"s2"o
k"s3"yes"s4"done"!foo
?
11
??????????? (cont.)
bazO3"foo"2s3"bar"s2"ok"s3"yes"s4
"done"arra1i3O3"foo"2s3"bar"s2"o
k"s3"yes"s4"done"!foo
undef
12
??????
  • PHP???????????????

a1 "foo" a2 new baz a3
"bar" a4 -1.2 data'hi'
'foo' data'foo' "bar"
13
???????????
  • ???????
  • ????????!

my var_re '(\w)\' my str_re
's\d"(.?)"' my int_re 'i(-?\d)' my
dbl_re 'd(-?\d(?\.\d)?)' my arr_re
'a(\d)' my obj_re 'O\d"(.?)"\d' my
nul_re '(N)' my bool_re 'b(01)'
14
???????????(cont.)
  • ???????????
  • ?????????? (5.6 ?????)
  • PHP ?????1????????
  • Perl ?????
  • ParseRecDescent
  • ?? (ParseFastDescent?)
  • ???????

lt??gt?Perl?????????????lt/??gt
15
??????????? (cont.)
  • TextBalanced ???
  • Damian Conway ?
  • ParseRecDescent ????
  • ???????????????
  • ????????????OK

my bracket extract_bracketed(data, '')
16
PHPSession ???
  • Serializer ?Pluggable??????
  • PHP ?? WDDX ????? (PHPSession ????????
    WDDX.pm????????)
  • Strategy Pattern
  • sess_ ??????????error
  • create gt 1 ????????

17
API
use PHPSession my session
PHPSession-gtnew(id) session id my id
session-gtid get/set session data my foo
session-gtget('foo') session-gtset(bar gt
bar) remove session data session-gtunregister
('foo')
18
API (cont.)
remove all session data session-gtunset
check if data is registered session-gtis_registere
d('bar') save session data session-gtsave
destroy session session-gtdestroy
19
PHP???
  • PHP????Perl?????
  • Perl(??) gt PHP (??) gt Perl(????)
  • PHP???????? PHPSessionObject ???? bless
  • _class ???PHP?????????

20
ApacheSessionPHP
  • ApacheSession
  • ??????????????
  • Store, Lock, Generate, Serialize
  • Serialize ? Store ????????
  • Serialize PHPSession ???
  • Store ???????? PHP?????(sess_SESSION_ID)

tie session, ApacheSessionPHP
21
????
  • ???????????
  • Bug Report ? Patch ???????
  • Y! inc ???(?)
  • PHP????????????????
  • ????????????????
  • PHP?Web???????????????
  • ????????????

22
??????????
use ApacheCookie use ApacheRequest use
DigestMD5 qw(md5_hex) use PHPSession my r
ApacheRequest-gtnew(Apache-gtrequest) my sid
get_sid() gen_sid() my sess
PHPSession-gtnew(sid, create gt 1
) sess-gtset(name gt 'miyagawa') sess-gtset(ema
il gt 'miyagawa_at_bulknews.net') sess-gtsave()
23
?????????? (cont.)
my cookie ApacheCookie-gtnew(r, -name gt
'PHPSESSID', -value gt sid, -path gt
'/', ) cookie-gtbake r-gtinternal_redirect("/php
-session/index.php") sub get_sid my
cookies ApacheCookie-gtfetch return ?
cookiesPHPSESSID ? cookiesPHPSESSID-
gtvalue undef
24
?????????? (cont.)
lt?php session_start() ?gt Name lt? name
?gtltbrgt Email lt? email ?gtltbrgt SID lt?
PHPSESSID ?gt
25
?????
  • PHPSessionMySQL
  • ?????? MySQL ?????
  • WDDX ????
  • TestPHP
  • InlinePHP
  • TomcatSession
Write a Comment
User Comments (0)
About PowerShow.com