當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Response::download方法代碼示例

本文整理匯總了PHP中Response::download方法的典型用法代碼示例。如果您正苦於以下問題:PHP Response::download方法的具體用法?PHP Response::download怎麽用?PHP Response::download使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Response的用法示例。


在下文中一共展示了Response::download方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDownload

 public function getDownload()
 {
     //PDF file is stored under project/public/download/info.pdf
     $file = public_path() . "/download/info.pdf";
     $headers = array('Content-Type: resume/docx');
     return Response::download($file, 'alexandra_gutierrez_resume.pdf', $headers);
 }
開發者ID:agutie1995,項目名稱:blog.dev,代碼行數:7,代碼來源:HomeController.php

示例2: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $filename = $this->argument('set') . "set.arff";
     $handle = fopen($filename, 'w+');
     $text = "@relation 'price'\n@attribute y {-1,1}\n@attribute x0 numeric\n@attribute x1 numeric\n@attribute x3 numeric\n@attribute x4 numeric\n@attribute x5 numeric\n@attribute x6 numeric\n@attribute x7 numeric\n@attribute x8 numeric\n@attribute x9 numeric\n@data\n\n";
     $set = \MkmScraper\Set::find($this->argument('set'));
     $array = array(array());
     foreach ($set->mythics as $card) {
         foreach ($card->graphPrices as $key => $price) {
             $row = array();
             $row[] = $price->priceClass();
             $row[] = $price->card->set->daysFromReleaseDate($price->date);
             $row[] = $price->card->set->daysFromRotationDate($price->date);
             $row[] = $price->tournamentDiffWeek();
             $row[] = $price->tournamentDiffTwoWeek();
             $row[] = $price->articlesDiffLastWeek();
             $row[] = $price->articlesDiffLastTwoWeek();
             $row[] = $price->otherCardMovementDay();
             $row[] = $price->otherCardMovementWeek();
             $row[] = $price->boostersOpen();
             $array[] = $row;
         }
     }
     foreach ($array as $row) {
         foreach ($row as $item) {
             $text .= $item . ",";
         }
         $text .= "\n";
     }
     file_put_contents($filename, $text);
     return \Response::download($this->argument('set') . 'set.arff', $this->argument('set') . 'set.arff', array('Content-Type' => 'text/aarf'));
 }
開發者ID:neyko5,項目名稱:mkmscraper,代碼行數:37,代碼來源:ExportSet.php

示例3: store

 /**
  * Store a newly created resource in storage.
  * POST /policies
  *
  * @return Response
  */
 public function store($id)
 {
     //
     $download = AdminPolicies::where('download_id', $id)->first();
     $destinationPath = storage_path('download_files/' . $download->pdffile);
     return Response::download($destinationPath);
 }
開發者ID:joshbrosas,項目名稱:stileaveapp,代碼行數:13,代碼來源:PoliciesController.php

示例4: getDownload

 public function getDownload()
 {
     //to prevent users from downloading posters created by other people we get the folder hash from the session.
     $hash = Session::get('hash');
     $destinationPath = 'uploads/' . $hash;
     return Response::download($destinationPath . '/poster.jpg');
 }
開發者ID:bankorh,項目名稱:missingpetflyer,代碼行數:7,代碼來源:HomeController.php

示例5: exportCustomerData

 public function exportCustomerData()
 {
     $customers = CustomerData::orderBy('id')->get();
     $customers = $customers->toArray();
     $filename = CustomerData::exportData($customers);
     return Response::download(public_path($filename));
 }
開發者ID:kongbhop,項目名稱:estateProject,代碼行數:7,代碼來源:CustomerController.php

示例6: download

 protected function download(Path $path)
 {
     // check basic auth headers as well, so if specified,
     // client doesn't have to go through the login and cookie dance.
     Auth::onceBasic("username");
     // check we're logged in
     if (!Auth::check()) {
         Session::flash('redirect', URL::current());
         return Redirect::route('login');
     }
     // record the download in the db
     $record = $path->loadCreateRecord($path);
     $record->downloaded_at = $record->freshTimestamp();
     $record->increment('downloads');
     $record->save();
     $isMisc = strpos($path->getRelative(), '/Misc/') === 0;
     if ($isMisc || $path->isSafeExtension()) {
         // check if the extension is safe to download
         $file = new AsciiSafeDownloadFile($path->getPathname());
         // see comments in AsciiSafeDownloadFile class
         $baseName = $path->getBasename();
         $baseName = str_replace('%', '', $baseName);
         try {
             return Response::download($file, $baseName);
         } catch (InvalidArgumentException $e) {
             App::abort(500, 'This file has a malformed filename. Please contact an admin.');
         }
     } else {
         App::abort(403, sprintf('File type "%s" not allowed', $path->getExtension()));
     }
 }
開發者ID:Lord-Simon,項目名稱:MangaIndex,代碼行數:31,代碼來源:BaseController.php

示例7: create

 public function create($type = 'csv')
 {
     try {
         $export = static::getExportForType($type);
     } catch (Exception $e) {
         App::abort(404);
     }
     $export->user_id = Auth::user()->id;
     $export->filename = $export->generateFilename();
     $export->path = $export->folderPath();
     $export->setLogbooks(Input::get('logbooks'));
     $save = Input::has('save') ? (bool) Input::get('save') : true;
     if ($export->run($save)) {
         if ($save == false) {
             $res = Response::make($export->content);
             $res->header('Content-type', $export->getContentType());
             return $res;
         } else {
             $export->save();
             return Response::download($export->fullPath(), $export->filename, ['Content-type' => $export->getContentType()]);
         }
     } else {
         return Redirect::to(action('ExportsController@index'))->with('message', ['content' => 'Er is iets mis gegaan met exporteren.', 'class' => 'danger']);
     }
 }
開發者ID:y0sh1,項目名稱:logboek,代碼行數:25,代碼來源:ExportsController.php

示例8: downloadFile

 public static function downloadFile($id)
 {
     $record = self::find($id);
     if (!$record) {
         return \Response::json(['success' => false, 'message' => 'No record ...']);
     }
     return \Response::download($record->file_url, basename($record->file_name), []);
 }
開發者ID:binaryk,項目名稱:credite,代碼行數:8,代碼來源:UploadedDoc.php

示例9: downloadingLocalOrCloudFiles

 protected function downloadingLocalOrCloudFiles($fname)
 {
     if (!config('veer.use_cloud_files')) {
         return \Response::download(storage_path() . '/app/' . config('veer.downloads_path') . "/" . $fname);
     } else {
         return redirect(config('veer.cloudstorage_path') . '/' . config('veer.downloads_path') . '/' . $fname);
     }
 }
開發者ID:artemsk,項目名稱:veer-core,代碼行數:8,代碼來源:DownloadController.php

示例10: download_file

 /**
  * Download file
  *
  * @return Response
  */
 public function download_file($filename)
 {
     $file = public_path() . "/uploads/{$filename}";
     if (File::isFile($file)) {
         $headers = array('Content-Type: application/pdf', 'application/octet-stream', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/pdf');
         return Response::download($file, $filename, $headers);
     }
 }
開發者ID:aXeLbEn12,項目名稱:ReliefOps,代碼行數:13,代碼來源:PreparednessResponseController.php

示例11: profilepicture

 /**
  * Show artist profile picture
  *
  * @return Response
  */
 public function profilepicture($id, $type)
 {
     $pic = Picture::find($id);
     if ($pic) {
         return Response::download(storage_path() . "/pictures/" . $pic->name . "-" . $type . $pic->extension);
     } else {
         return Response::download(storage_path() . "/no-user.png");
     }
 }
開發者ID:centaurustech,項目名稱:musicequity,代碼行數:14,代碼來源:UsersController.php

示例12: picture

 /**
  * Show hub picture
  *
  * @return Response
  */
 public function picture($id)
 {
     $pic = Picture::find($id);
     if ($pic) {
         return Response::download(storage_path() . "/pictures/" . $pic->name . ".png");
     } else {
         return App::abort(404);
     }
 }
開發者ID:centaurustech,項目名稱:musicequity,代碼行數:14,代碼來源:HubController.php

示例13: getFileBinToShowById

 public function getFileBinToShowById($id)
 {
     /** @var FileModel $file */
     $file = FileModel::where('id', $id)->first();
     if (!$file || !$file->baseFile) {
         throw new NotFoundException(NotFoundException::FileNotFound);
     }
     return \Response::download($file->baseFile->getLocalCachePath(), [], 'inline');
 }
開發者ID:lialosiu,項目名稱:amaoto-core,代碼行數:9,代碼來源:FileController.php

示例14: getfile

 public function getfile($filename)
 {
     $myfile = storage_path() . '/uploads/traces/' . $filename;
     if (!\File::exists($myfile)) {
         echo "File not exists.";
     } else {
         return \Response::download($myfile, $filename);
     }
 }
開發者ID:renciebautista,項目名稱:pcount2,代碼行數:9,代碼來源:DeviceErrorController.php

示例15: do_download

 public function do_download($file)
 {
     //return Str::random(100);
     if (Auth::check()) {
         // return Redirect::to('https://www.sugarsync.com/pf/D9604663_69636075_6847618?directDownload=true');
         $pathToFile = '/Users/myalienvirus/Sites/downloads/public/downloads/';
         return Response::download($pathToFile . 'office11.Mac.iso');
     }
     return Redirect::to('/');
 }
開發者ID:elizelluz,項目名稱:descargas,代碼行數:10,代碼來源:UserController.php


注:本文中的Response::download方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。