PHP Download Page

前端 未结 5 789
我在风中等你
我在风中等你 2021-01-29 07:13

How do these PHP download pages (e.g. somesite.com/download.php?id=somefile) often found work?

I originally thought of a page that does the counter stuff, and then simpl

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-29 08:09

    This isn't really a PHP-specific issue. In order to make the web browser "download" (whether it be the contents of a static file or the body of a dynamically generated report), set the Content-Disposition header in the HTTP response. PHP allows you to set the HTTP headers using the header function, so your PHP script should do this before streaming the file contents back to the HTTP client.

提交回复
热议问题