Home > Tags > ダウンロード
ダウンロード
CakePHPでファイルのダウンロードのやり方。
例えば、
$output_file = sprintf(DB_NAME."_%s.db", date("Ymd-hi")); system("/usr/bin/pg_dump -u ".DB_NAME." < ".AUTH_USER_FILE_PATH." > ".DB_EXPORT_PATH.$output_file); $this->autoRender = false; Configure::write('debug', 0); header("Content-disposition: attachment; filename=".$output_file); header("Content-type: application/octet-stream; name=".$output_file); $result = file_get_contents(DB_EXPORT_PATH.$output_file); print($result); return;
みたいな。
- Comments: 0
- Trackbacks: 0
Home > Tags > ダウンロード
- Search
- Feeds
- Meta