如何使用PHP session?
在往PHP Session里面保存信息之前,需要首先使用session_start()函数来启动session,
这个函数必须在<html>标签之前调用。代码如下:
<?php session_start(); ?>
<html>
<body>
</body>
</html>
在Session启动以后,可以使用PHP $_SESSION变量来获取和设置session变量,实例代码如下:
<?php
session_start();
// store session data
$_SESSION['views']=1;
?>
如果需要删除一些session数据,你可以使用unset()函数或者session_destroy()函数,
unset()函数用来把某个session变量的值清空,代码如下:
<?php
unset($_SESSION['views']);
?>
还可以调用session_destroy()函数把整个session给销毁, 代码如下:
<?php
session_destroy();
?>
相关文档:
转载的PHP面试题
1. 基本知识点
HTTP协议中几个状态码的含义:503 500 401 200 301 302。。。
Include require include_once require_once 的区别.
PHP/Mysql中几个版本的进化史,比如mysql4.0到4.1,PHP 4.x到5.1的重大改进等等。
HEREDOC介绍
写出一些php魔幻方法;
一些编译php时的configure 参数
向php传入 ......
PHP5.2.4之前的版本无需设置时区。下面是修改PHP时区的三个办法。
1、修改PHP.ini这个文件
找到date.timezone这行,去掉前面的分号,改成: date.timezone = Asia/Shanghai 2、修改 .htaccess文件
修改.htaccess文件有两种办法,下面的两条语句只要有一条即可 php_value date.timezone Asia/Shanghai
......
php有一组进程控制函数,使得php能在*nix系统中实现跟c一样的创建子进程、使用exec函数执行程序、处理信号等功能。
引用
Process Control support in PHP implements the Unix style of process creation, program execution, signal handling and process termination. Process Control should not be enabled within a ......
http://www.oracle.com/technology/global/cn/pub/notes/technote_php_instant.html
为 Linux 和 Windows 安装 PHP 和 Oracle 10g Instant Client
作者:Christopher Jones,甲骨文公司的咨询技术人员
发布日期:2004 年 12 月
Oracle 10g Instant Client(免费下载)是PHP 与远程 Oracle 数据库连接的最简单方式,它 ......
The define() function defines a constant.
define()函数的作用是:定义一个常量。
Constants are much like variables, except for the following differences:
常量[constant]与变量[variable]有很多相似的地方,因此,很容易混淆;下面,我们列举一下常量[constant]与变量[variable]之间的不同点:
A const ......