如何使用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有一组进程控制函数,使得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 ......
使用popen结合SHELL命令也可以实现多进程并发编程。
实例如下:
<?php
//b.php文件
$file = 'testdir/file.txt';
for ($i=0;$i<10;$i++){
$fp = fopen($file,'a+');
fputs($fp, $i.'\r\n');
fclose($fp);
sleep(1);
}
?> ......
办法一
select * from V$NLS_PARAMETERS
$conn = oci_connect('scott', 'donkey', 'demo', 'zhs16gbk');
while ($dat = oci_fetch_row($cur)) {
print_r(iconv('gb2312', 'utf-8', $dat[0])); //$nickname = mb_convert_encoding($dat[0], 'utf-8', 'gbk');&n ......
PHP函数setcookie()用来设置cookie.
setcookie()函数必须在<html>标签之前调用,语法是setcookie (name, value, expire,
path, domain) 例如:
<?php
setcookie(”user”, “Alex
Porter”, time()+3600);
?>
<?php
setcookie(”url”, “http://www.mianwww. ......