为会话变量赋值的方法。 [英] Ways to assign a value to a session variable.
问题描述
我正在徘徊哪种方式为会话变量分配值
存在。以下哪个例子可行。
示例#1:
session_start();
session_register(" ex" );
$ ex = 2.0;
示例#2:
在first.php中:
session_start();
session_register(" ex");
在second.php:
$ ex = 2.0;
示例#3:
在first.php中:
session_start();
session_register(& ; ex");
加载second.php?ex = 2.0
示例#4:
在first.php中:
session_start();
session_register(" ex");
通过提交第一个表单转到second.php .php,
包含表格变量$ ex。
示例#4接缝不起作用?可以预期吗?
I am wandering which way to assign a value to a session variable
exist. Which of the following examples will work.
Example #1:
session_start();
session_register("ex");
$ex = 2.0;
Example #2:
In first.php:
session_start();
session_register("ex");
In second.php:
$ex = 2.0;
Example #3:
In first.php:
session_start();
session_register("ex");
Load second.php?ex=2.0
Example #4:
In first.php:
session_start();
session_register("ex");
Go to the second.php via submission of the form on the first.php,
which contains form-variable $ex.
Example #4 seams not to work? Is it expectable?
推荐答案
ex = 2.0;
示例#2:
在first.php中:
session_start();
session_register(" ex");
在second.php中:
ex = 2.0;
Example #2:
In first.php:
session_start();
session_register("ex");
In second.php:
ex = 2.0;
示例#3:
在first.php中:
session_start();
session_register(" ex");
加载second.php?ex = 2.0
示例#4:
在first.php中:
session_start();
session_register(" ex");
通过在first.php上提交表单转到second.php,
包含表单变量
ex = 2.0;
Example #3:
In first.php:
session_start();
session_register("ex");
Load second.php?ex=2.0
Example #4:
In first.php:
session_start();
session_register("ex");
Go to the second.php via submission of the form on the first.php,
which contains form-variable
ex。
示例#4接缝不起作用?可以预期吗?
ex.
Example #4 seams not to work? Is it expectable?
这篇关于为会话变量赋值的方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!