PHP REST API 是否支持 ETAG?
是否有可能在 PHP 中创建支持 ETag 的 REST API?
如果是,如何使用 PHP 中的解析响应来考虑 ETag?
Is there a possibility to create a REST API in PHP that supports ETags?
And if yes, how could you use parse the response in PHP to consider the ETags?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
$_SERVER
If-Match
中找到相应的请求头。是键HTTP_IF_MATCH
,If-None-Match
对应HTTP_IF_NONE_MATCH
。为了向客户端发送正确的 ETag,请使用
ETag
标头,例如header( 'ETag: ' .generateEtag() );
。您只需要确保您的 ETag 正确代表服务的响应即可。You can find the corresponding request headers in
$_SERVER
If-Match
. Is the keyHTTP_IF_MATCH
,If-None-Match
corresponds toHTTP_IF_NONE_MATCH
.In order to send proper ETags to the client use the
ETag
header likeheader( 'ETag: ' . generateEtag() );
. You just need to ensure that your ETag represents the response of the service properly.