http_send_content_disposition
(PECL pecl_http >= 0.10.0)
http_send_content_disposition — Content-Disposition を送信する
説明
bool http_send_content_disposition
( string
$filename
[, bool $inline = false
] )Content-Disposition を送信します。 Content-Disposition ヘッダは、 実際に送信するデータがファイルなどであり、それをクライアント/ユーザーに "保存" させたい (ブラウザのポップアップ "名前を付けて保存..." を出させたい) 場合に便利です。
注意: この関数は、 http_send_data() や http_send_file() そして http_send_stream() と組み合わせて使用することを想定しています。
パラメータ
-
filename -
"名前を付けて保存..." ダイアログで表示するファイル名。
-
inline -
これを
TRUEに設定し、かつユーザーエージェントがその content type の処理方法を知っている場合は、ポップアップウィンドウが表示されません。
返り値
成功した場合に TRUE を、失敗した場合に FALSE を返します。
参考
- http_send_data() - 任意のデータを送信する
- http_send_file() - ファイルを送信する
- http_send_stream() - ストリームを送信する
- PHP 5.1.0 以降を使用している場合は HttpResponse クラス