How do you make an etag that matches Apache?

后端 未结 4 1278
自闭症患者
自闭症患者 2021-02-04 10:13

I want to make an etag that matches what Apache produces. How does apache create it\'s etags?

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 10:18

    the answer above (from Chris) works well, but can be simplified using an implicit cast in the sprintf:

    sprintf('"%x-%x-%x"', $s['ino'], $s['size'], str_pad($s['mtime'], 16, "0"));
    

    The suggested %016x doesn't work because the padding is applied after the conversion to hex, rather than before.

提交回复
热议问题