我们何时何地使用session_id() [英] when and where do we use session_id()
本文介绍了我们何时何地使用session_id()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法理解下面的代码,我不知道我们何时在session_start()之前使用session_id()
<?php
if($ _ GET){
// 在session_start()之前定义session_id()是秘密
session_id($ _ GET [' session_id']);
session_start();
echo 数据:。 $ _SESSION [' theVar'];
// 在以下命令之前使用您的数据
session_destroy();
session_commit();
} else {
// 常见会话声明在这里
在session_start();
$ session_id = session_id();
$ _SESSION [' theVar'] = theData;
echo your.php?session_id = 。 $ session_id ;
}
?>
on另一方面,session_id()在哪里用?它的用途是什么?!
我希望你解释一下或给我一个更好的例子!不只是复制php.net的描述!
提前谢谢!
解决方案
_GET){
// 在session_start()之前定义session_id()是秘密
session_id(
_GET [' session_id']);
session_start();
echo 数据:。
_SESSION [' theVar'];
// 在以下命令之前使用您的数据
session_destroy();
session_commit();
} else {
// 常见会话声明在这里
在session_start();
I can't understand the code below and I don't know when we use session_id() before session_start()
<?php
if($_GET){
//defining the session_id() before session_start() is the secret
session_id($_GET['session_id']);
session_start();
echo "Data: " . $_SESSION['theVar'];
//use your data before below commands
session_destroy();
session_commit();
}else{
//common session statement goes here
session_start();
$session_id=session_id();
$_SESSION['theVar'] = "theData";
echo "your.php?session_id=" . $session_id;
}
?>
on the other hand , where is session_id() used ?! what's its usage ?!
i want you to explain it or give me a better example ! not just copying the description of php.net !
thank you in advance !
解决方案
_GET){ //defining the session_id() before session_start() is the secret session_id(
_GET['session_id']); session_start(); echo "Data: " .
_SESSION['theVar']; //use your data before below commands session_destroy(); session_commit(); }else{ //common session statement goes here session_start();
这篇关于我们何时何地使用session_id()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文