PHP 怎么设置过期时间
1个回答
2017-02-01
展开全部
<?php
class Qiniu_RS_GetPolicy
{
public $Expires;
public function MakeRequest($baseUrl, $mac) // => $privateUrl
{
$deadline = $this->Expires;
if ($deadline == 0) {
$deadline = 3600;
}
$deadline += time();
$pos = strpos($baseUrl, '?');
if ($pos !== false) {
$baseUrl .= '&e=';
} else {
$baseUrl .= '?e=';
}
$baseUrl .= $deadline;
$token = Qiniu_Sign($mac, $baseUrl);
return "$baseUrl&token=$token";
}
}
<?php
function Qiniu_RequireMac($mac) // => $mac
{
if (isset($mac)) {
return $mac;
}
global $QINIU_ACCESS_KEY;
global $QINIU_SECRET_KEY;
return new Qiniu_Mac($QINIU_ACCESS_KEY, $QINIU_SECRET_KEY);
}
class Qiniu_RS_GetPolicy
{
public $Expires;
public function MakeRequest($baseUrl, $mac) // => $privateUrl
{
$deadline = $this->Expires;
if ($deadline == 0) {
$deadline = 3600;
}
$deadline += time();
$pos = strpos($baseUrl, '?');
if ($pos !== false) {
$baseUrl .= '&e=';
} else {
$baseUrl .= '?e=';
}
$baseUrl .= $deadline;
$token = Qiniu_Sign($mac, $baseUrl);
return "$baseUrl&token=$token";
}
}
<?php
function Qiniu_RequireMac($mac) // => $mac
{
if (isset($mac)) {
return $mac;
}
global $QINIU_ACCESS_KEY;
global $QINIU_SECRET_KEY;
return new Qiniu_Mac($QINIU_ACCESS_KEY, $QINIU_SECRET_KEY);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询