无论我做什么,Cookie都不会在PHP页面上运行! [英] Cookie will never work on a PHP page no matter what I do!

查看:61
本文介绍了无论我做什么,Cookie都不会在PHP页面上运行!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在html页面上尝试过JS cookie,其中包含链接到php拼图益智游戏的iFrame代码。这没用。

我在php页面上尝试过JS cookie; php页面上的php cookie,html页面上的php cookie,并没有一个有效。


[PHP]<?php

session_start();

$ rating1 = $ rating;

session_destroy();

$ today = time();

$ atoday = GETDATE($今天); //将日期输入数组

$ atoday-> mon ++; //将月份设置为下个月

$ month = $ atoday-> mon;

$ year = $ atoday-> year;

if($ month> 12)

{

$ month = 1;

$ year ++;

}

$ cexpire = mktime(0,0,0,$ month,1,$ year);

$ linkid = $ QUERY_STRING; //将链接ID号作为整数。

global $ slinkid,$ cname;

$ slinkid = strval($ linkid); //转换为字符串

$ cname =" test" ;;

setcookie($ cname,$ slinkid,$ cexpire);

?> [/ PHP]

I''ve tried JS cookie on the html page that contains the iFrame code linking to the php jigsaw puzzle game. That did NOT work.
I''ve tried JS cookie on the php page; php cookie on the php page, php cookie on the html page, and none of those have worked.

[PHP]<?php
session_start();
$rating1=$rating;
session_destroy();
$today=time();
$atoday=getdate($today); //Get the date into an array
$atoday->mon++; //set the month to next month
$month=$atoday->mon;
$year=$atoday->year;
if ($month > 12)
{
$month=1;
$year++;
}
$cexpire=mktime(0,0,0,$month,1,$year);
$linkid=$QUERY_STRING; //get the link id number as an integer.
global $slinkid, $cname;
$slinkid=strval($linkid); //convert to a string
$cname="test";
setcookie($cname,$slinkid,$cexpire);
?> [/PHP]

展开 | 选择 < span class =codeDivider> | Wrap | 行号

推荐答案

rating1 =
rating1=


评级;

session_destroy();
rating;
session_destroy();


今天=时间();
today=time();


这篇关于无论我做什么,Cookie都不会在PHP页面上运行!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆