当前位置: 首页>>代码示例>>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;未经允许,请勿转载。