<?php
session_start();
$_SESSION['name'] = 'jobs';
//在这里删除name的session值
unset($_SESSION['name']);
if (isset($_SESSION['name'])) {
echo $_SESSION['name'];
}
session_start();
$_SESSION['name'] = 'jobs';
//在这里删除name的session值
unset($_SESSION['name']);
if (isset($_SESSION['name'])) {
echo $_SESSION['name'];
}
2015-11-05
<?php
//在这里设置name的session值为jobs
$_session['name'] = 'jobs';
echo $_SESSION['name'];
//在这里设置name的session值为jobs
$_session['name'] = 'jobs';
echo $_SESSION['name'];
2015-11-05
<?php
//补充路径参数,实现有效路径的设置
setcookie('test', '1', 0,'/path');
var_dump($_COOKIE['test']);
//补充路径参数,实现有效路径的设置
setcookie('test', '1', 0,'/path');
var_dump($_COOKIE['test']);
2015-11-05
<?php
setcookie('test', time());
//在这里试着删除test的cookie值
setcookie('test',time(),time()-1);
var_dump($_COOKIE);
setcookie('test', time());
//在这里试着删除test的cookie值
setcookie('test',time(),time()-1);
var_dump($_COOKIE);
2015-11-05
<?php
$value = time();
//在这里设置一个名为test的Cookie
setcookie("test",$value);
if (isset($_COOKIE['test'])) {
echo 'success';
}
$value = time();
//在这里设置一个名为test的Cookie
setcookie("test",$value);
if (isset($_COOKIE['test'])) {
echo 'success';
}
2015-11-05
echo仅能输出字符串,对于其他变量无能为力而print_r则是把一个变量的所有人类可阅读的信息输出例如print_r可以以数组为输入,而输出的是人能看懂的数组结构:$arr = array("1"=>"arr1", "2"=>"arr2", "3"=>"arr3", "4"=>array("4a","4b"));print_r($arr);输出结果为:Array ( [1] => arr1 [2] => arr2 [3] => arr3 [4] => Ar...
2015-11-04
<?php
//格式化字符串
$str = '100.1';
$result = sprintf('%01.3f',$str);
echo $result;
?>
//格式化字符串
$str = '100.1';
$result = sprintf('%01.3f',$str);
echo $result;
?>
2015-11-03