Forcing page loading in php

How to make the browser load the current page? a page with the title Content-type: text / plain, for example, using PHP?

If the user goes to this page, a download window will appear (browser download dialog with the usual “Save As”

0
php
Jan 21 '10 at 3:26
source share
1 answer

straight from http://php.net/header

<?php // there is contention over if this mime-type is right, but just use it for now header('Content-type: text/javascript'); header('Content-Disposition: attachment; filename="file.js"'); readfile('file.js'); // echo the file ?> 

NOTE: this should be done before any other output (and can only be about the only one on the page if you do not want another output in your file).

In addition, there are a billion cheats on this issue in Stack Overflow. Too lazy to copy them all.

+1
Jan 21 '10 at 3:29
source share



All Articles