- 論壇徽章:
- 0
|
header 應(yīng)用:在使用header之前一定不能有任何的輸出,類似于echo ,print 也不能有html語句。否則會出現(xiàn),header has been sended 的錯誤提示
session篇:
簡介:
Session support in PHP consists of a way to preserve certain data across
subsequent accesses. This enables you to build more customized applications and
increase the appeal of your web site.
A visitor accessing your web site is assigned a unique id, the so-called
session id. This is either stored in a cookie on the user side or is propagated
in the URL.
----------------------------------------------------------------------
session_start() initialize session data,
session_start()creates a session or resumes the current one based on the current session id that's being pasted via a request such as
GET,POST,or a cookie.
//page1.php
//page2.php
--------------------------------------------------------
注意在使用session時,要注意同header相同的問題(上有描述)
在一些網(wǎng)上下載的源程序中還能發(fā)現(xiàn)session_register(..)函數(shù)。
-------------------------------------------------------------
session_register() accepts a variable number of
arguments, any of which can be either a string holding the name of a variable or
an array consisting of variable names or other arrays. For each name,session_register() registers the global variable with
that name in the current session.
session_refister() 的使用依賴于register_globals=on但是自php 4.2.0起,這一選項(xiàng)被默認(rèn)設(shè)置為off.
you'd better use $_SESSION instead of session_register().
本文來自ChinaUnix博客,如果查看原文請點(diǎn):http://blog.chinaunix.net/u/17444/showart_108890.html |
|