Chinaunix首页 | 论坛 | 博客
  • 博客访问: 43544
  • 博文数量: 34
  • 博客积分: 695
  • 博客等级: 上士
  • 技术积分: 342
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-14 07:24
文章分类

全部博文(34)

文章存档

2007年(12)

2006年(22)

我的朋友

分类:

2006-05-06 14:32:47

header 应用:在使用header之前一定不能有任何的输出,类似于echo ,print 也不能有html语句。否则会出现,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
session_start();
$_SESSION["login"]="yes";
.
.
.
?>
//page2.php
if($_SESSION["login"]=="yes")
{
}
else
{
}
?>
--------------------------------------------------------
注意在使用session时,要注意同header相同的问题(上有描述)
在一些网上下载的源程序中还能发现session_register(..)函数。
-------------------------------------------------------------
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起,这一选项被默认设置为off.

you'd better use $_SESSION instead of session_register().






阅读(692) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~