开发者

having a dynamic image in PHP with GET params appear in <img> tags

I understand this question is pretty similar to this que开发者_开发问答stion: Point an <img> tag to a image dynamically generated by PHP?

But in mine I need to send it different GET parameters each time (sometimes it's a certain set of GET params and sometimes it's a completely different set). This solution was unable to fix it: Point an <img> tag to a image dynamically generated by PHP?

Does anybody know how to overcome this issue?


GET parameters are just the query strings appended to the end of the URL. Thus, to set the parameters foo and bar to 42 and cubiculum, respectively, the URL given in the IMG's SRC attribute would end with ?foo=42&bar=cubiculum.


You'll need to add the flag QSA to the RewriteRule to maintain the QUERY_STRING after rewriting the URL


This perfectly legal and should work flawlessly:

<img src="http://example.com/img.jpg?get=data" /> 

This keeps the query string intact:

RewriteRule (.*).png(.*) $1.php$2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜