.


:




:

































 

 

 

 


7 - Cookies PHP

cookies ()

Cookie , - . , , . , , cookies.

, , , . . , - HTTP-. , http://www.example.org/index.html, www.example.org :

GET /index.html HTTP/1.1

Host: www.example.org

, , HTTP-. :

HTTP/1.1 200 OK

Content-type: text/html

Set-Cookie: name=value

( )

Set-cookie , , . , , name=value ( = ) . , http://www.example.org/spec.html www.example.org

:

GET /spec.html HTTP/1.1

Host: www.example.org

Cookie: name=value

Accept: */*

, , . , ,

. , , ,

.

cookie PHP setcookie:

bool setcookie (string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])

:

name ( , , )

value

expire . , , . timestamp. Timespamp - , 00:00:00 1 , 1970 .

path , , (/ - ).

domain , cookie

secure - , cookie HTTPS.

Cookie HTTP-, , HTML-, , setcookie HTML- echo.

, , . , - .

cookie $_COOKIE.

cookie isset.

: cookie:

setcookie value. , .

 

, . -. , , . . , , , . PHP .

. , , -.

, , session_start(). $_SESSION. , :

:

 

session_start() , , - .

( 32 ) session_id. , , .

 

unset ( ) session_destroy ( ).



<== | ==>
. | . . .
:


: 2016-12-17; !; : 767 |


:

:

, .
==> ...

1538 - | 1309 -


© 2015-2024 lektsii.org - -

: 0.011 .