【发布时间】:2012-08-06 03:17:08
【问题描述】:
这样做不好吗?
index.php
<img src = "image.php"/>
image.php
header('location: /location/to/another/image.jpg');
您可能正在考虑“他为什么要这样做”。以上只是我正在做的一个简单场景,我只是想知道这样做是否“可以接受”?
【问题讨论】:
-
只要能工作,就可以接受:)这是否是干净的代码是另一回事。
-
很难说出支持或反对它的理由。
-
为什么不直接在
image.php中加载/location/to/another/image.jpg? -
出于好奇,你为什么要这样做?
-
因为缓存原因需要在末尾添加一个字符串 ?id=438208 这只能在文件中完成,而不是在 html 代码中。