NenTang.vn
Thiết kế Lập trình Web BackendLập trình căn bản PHP
Session và Cookie trong PHP
PHP Nâng cao
Thời lượng: 83 phútĐọc khoảng: 2 phút
Danh mục hình và bảng
Từ viết tắt
Nội dung bài học không khai báo từ viết tắt bằng thẻ abbr.
Nội dung bài học
Difference Between Session and Cookie in PHP
Cookies are stored in browser as a text file format. It is stored limit amount of data.It is only allowing 4kb[4096bytes]. It is not holding the multiple variable in cookies. Sessions are stored in server side. It is stored unlimited amount of data.It is holding the multiple variable in sessions. we cannot accessing the cookies values in easily.So it is more secure.| Cookies | Sessions |
|---|---|
| Cookies are stored in browser as text file format. | Sessions are stored in server side. |
| It is stored limit amount of data. | It is stored unlimited amount of data |
| It is only allowing 4kb[4096bytes]. | It is holding the multiple variable in sessions. |
| It is not holding the multiple variable in cookies. | It is holding the multiple variable in sessions. |
| we can accessing the cookies values in easily. So it is less secure. | we cannot accessing the session values in easily.So it is more secure. |
| setting the cookie time to expire the cookie. | using session_destory(), we we will destroyed the sessions. |
| The setcookie() function must appear BEFORE the <html> tag. | The session_start() function must be the very first thing in your document. Before any HTML tags. |
php
php

