[英]Take Cookie value insert into php string
I'm making a simple page for our home server for keeping track of in game currency.. My problem was when this line $Tlab = number_format($Tlae - $TlSL + $TlSW , 2, '.', ''); 我正在为家用服务器制作一个简单的页面,以跟踪游戏币种。我的问题是,当这行$ Tlab = number_format($ Tlae-$ TlSL + $ TlSW,2,'。','');
is done, it does work and it spits out the 完成,它确实起作用,它吐出
fclose ($fp);
echo ("[Prv Amount is [$Tlae] ");
echo ("[Win Amount is [$TlSW] ");
echo ("[Loss is [$TlSL] ");
echo ("[Total [$Tlab] ");
Odd thing is.. the TLab will write its sum value to a cookie, however when it is put into the url to insert into the next page, the value is empty 奇怪的是.. TLab会将其总和值写入Cookie,但是当将其放入URL以插入下一页时,该值为空
<A HREF="curncy.php?Tlab=<?php echo $_REQUEST["Tlab"]; ?>"> [Next Round]</A><br />
Did I do something wrong, because any other values used will get passed on?? 我做错什么了吗,因为使用的任何其他值都会传递下去? Or as the cookie does store the $Tlab value [when I do an echo in the next page it does show correctly] how do I take that value from the cookie and give it a workable value
或者由于cookie确实存储了$ Tlab值[当我在下一页中执行回显时,它确实正确显示了]我如何从cookie中获取该值并为其提供可行的值
Option 1: 选项1:
On previeous page: setcookie('Tlab', $Tlab);
在可怕的页面上:
setcookie('Tlab', $Tlab);
On next page: $_COOKIE['Tlab'];
在下一页:
$_COOKIE['Tlab'];
Option 2: 选项2:
On previous page: <A HREF="curncy.php?Tlab=<?php echo $Tlab; ?>">
在上一页:
<A HREF="curncy.php?Tlab=<?php echo $Tlab; ?>">
On next page: $_REQUEST["Tlab"];
在下一页:
$_REQUEST["Tlab"];
or $_GET["Tlab"];
或
$_GET["Tlab"];
You should read more on cookies and http requests 您应该阅读有关Cookie和http请求的更多信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.