Home > Backend Development > PHP Tutorial > PHP session应用

PHP session应用

WBOY
Release: 2016-06-13 11:01:02
Original
848 people have browsed it

PHP session使用

??? 因为以前是学java的,现在使用php做项目觉得特别不习惯,特别是php的session机制,感觉比java落后很多。

?

??? 1、php使用session,是通过在各个页面传递session id来标识的。默认是通过cookie来传递,所以在php.ini配置文件中一定要开启支持cookie功能。

?

??? 2、要在配置文件中设置session.save_path,这是session临时文件保存的路径

?

??? 3、每次需要在页面中使用session时,要先session.start();开启session

?

??? 4、session的接收页面需要有header('Content-type: text/html; charset=utf-8');来传递session id

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template