如何获取由用户动态添加的通行证的最后修改 [英] How to get last-modified of the pass that is added by user dynamically

查看:132
本文介绍了如何获取由用户动态添加的通行证的最后修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



header('Last-Modified:'。date(D,d)在我的服务器上传过来之前, MYH:i:s,filemtime('/ Applications / MAMP / htdocs / passesWebserver / DigiClubCard.pkpass'))。'GMT + 07:00');

现在我的服务器中没有任何传递,并且我只有数据库中的传递数据,所以我应该更改此头以便进行上次修改的通行证?

解决方案

如果您要发送一个新的动态创建的通行证,请使用当前时间创建一个标题,您可以:

  //告诉PHP使用UTC 
date_default_timezone_set('UTC');

//用当前时间创建一个标题
header('Last-Modified:'。date(D,d MYH:i:s,time())。'GMT );

关于时区,HTTP / 1.1标准 RFC2616 州:


所有HTTP日期/时间戳都必须以格林威治标准时间
(GMT)表示,无一例外。为了HTTP的目的,GMT恰好等于UTC(协调世界时)。在
的前两种格式中,通过加入GMT作为时区的三字母
缩写表示,并且在读取
asctime格式时务必假定。 HTTP-date是区分大小写的,并且不得在
语法中包含
以外的特定LWS。

所以你不应该在7小时内加入GMT。


Before I had a pass in my server and I got last-modified by using this:
header('Last-Modified: ' . date("D, d M Y H:i:s", filemtime('/Applications/MAMP/htdocs/passesWebserver/DigiClubCard.pkpass')) . ' GMT+07:00'); Now I don't have any pass in my server and I only have data of pass in database, so what should I change this header in order to get last-modified of the pass?

解决方案

If you are sending a new, dynamically created pass, to create a header with the current time you can:

// Tell PHP to use UTC
date_default_timezone_set ('UTC');

// Create a header with the current time
header('Last-Modified: ' . date("D, d M Y H:i:s", time()) . ' GMT');

With regards to the timezone, Section 3.3.1 of the HTTP/1.1 standard RFC2616 states:

All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone, and MUST be assumed when reading the asctime format. HTTP-date is case sensitive and MUST NOT include additional LWS beyond that specifically included as SP in the grammar.

so you should not be adding on 7 hours to GMT.

这篇关于如何获取由用户动态添加的通行证的最后修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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