看板 PHP 關於我們 聯絡資訊
For example, if a user is accessing an image file on my server, is it possible to execute another PHP file at the same time? I want to record the ip, HTTP_USER_AGENT and HTTP_ACCEPT_LANGUAGE of the users who have accessed this image file. The difficult point is how to execute (or may say “trigger”) that PHP recording file at the time the user is accessing the image. I know I can read the content of the image to the PHP first then output it as an image and record the user's information meanwhile, but this method may occupy so much memory usage when the size of the image file is very large. For this reason, is it possible to make the user access the image file directly but also can trigger another PHP file at the same time? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.136.205.31 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1501358330.A.5B9.html
MarcoReus: header('Location: /web/path/to/file.jpg'); 07/30 12:33
MOONRAKER: does this work when the file is covered by redirect 07/30 15:36
MOONRAKER: rule in .htaccess? 07/30 15:37
MarcoReus: you need to do some "trick" to avoid infinte loop. 07/30 16:15