【发布时间】:2015-09-26 16:19:01
【问题描述】:
我通过查看this post 和this post 拼凑了一些代码。但我不太明白。
我想在我的 url 中包含一个时间戳,并检查时间戳是否已经过去了 2 个月。如果我们在 2 个月内,正常显示页面。如果超过 2 个月,请重定向页面。
这是我目前所拥有的,但它不起作用。关于如何让它正常工作的任何建议?
//test timestamp... this will come from the url as so: www.mywebsite.com?ts=1340037073
$timestamp = echo $_GET['ts'];
//check if it has expired (in seconds, 5256000 sec = 2 months).
if ((time() - $timestamp) < 5256000)
{
echo 'valid';
}
else
{
Header("Location: http://www.google.com");
}
【问题讨论】:
-
所以...你在找什么? :D
-
你的问题是什么??
-
对。对不起。我的问题是:如何修改代码以使其正常工作?
标签: php string url redirect timestamp