当前位置: 首页>>代码示例>>PHP>>正文


PHP sfWebResponse::setHttpHeader方法代码示例

本文整理汇总了PHP中sfWebResponse::setHttpHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebResponse::setHttpHeader方法的具体用法?PHP sfWebResponse::setHttpHeader怎么用?PHP sfWebResponse::setHttpHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfWebResponse的用法示例。


在下文中一共展示了sfWebResponse::setHttpHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderReport

 /**
  * This is the final Step in this 3 steps process:
  * <ol> 
  * <li>Step 1 consists in generating the XML bsaed raw data for the report. </li>
  * <li>Step 2 consists in merging this raw data with a XSL-FO template to give it
  * the presentation information. XSL-FO acts as an intermediate language used 
  * to render the final repor in any format with a last transformation. </li>
  * <li>Step 3 consists on rendering the XSL-FO representtion (the intermediate 
  * language) of the report to the PDF output fromat.</li>
  * <ol>
  * 
  * @param DOMDocument   $xslFo    The XSL-FO representation of the processed 
  * report, as we get it just after step 2 in this 3 steps process.
  * @param sfWebResponse $response The Response Object, should be passed all 
  * the way down from the action. So we can change some headers', ContentType
  * to 'application/pdf'.
  * 
  * @see %sf_plugins_dir%/NeatReports/config/sfExportGlobals.yml
  * @return String With the rendered report content. PDF Binary stream returned
  * by ApacheFop.
  */
 public function renderReport(DOMDocument $xslFo, sfWebResponse $response = null)
 {
     $response->setContentType('application/pdf');
     $response->setHttpHeader('Content-Disposition', "attachment; filename=report.pdf");
     $tStamp = microtime(true);
     $executable = stristr(PHP_OS, "WIN") ? 'fop.cmd' : 'fop';
     $output = array();
     $returnVar = 0;
     $foPath = __DIR__ . '/RenderPDF/tmp/report.fo.' . $tStamp;
     $pdfPath = __DIR__ . '/RenderPDF/tmp/report.pdf.' . $tStamp;
     try {
         file_put_contents($foPath, $xslFo->saveXML());
         $command = $this->_fopPath . $executable . ' -fo ' . $foPath . ' -pdf ' . $pdfPath;
         exec($command, $output, $returnVar);
         if ((bool) $returnVar) {
             throw new Exception(implode(PHP_EOL, $output), $returnVar);
         }
     } catch (Exception $e) {
         $ex = new Exception('Error executing Apache FOP, return value is pased to Exception Code.' . ' Command execution output follows:' . PHP_EOL . implode(PHP_EOL, $output), $returnVar, $e);
         throw $ex;
     }
     $out = file_get_contents($pdfPath);
     unlink($foPath);
     unlink($pdfPath);
     return $out;
 }
开发者ID:backstageel,项目名称:neatReports,代码行数:47,代码来源:RenderPdfConsole.php

示例2: renderReport

 /**
  * This is the final Step in this 3 steps process:
  * <ol> 
  * <li>Step 1 consists in generating the XML bsaed raw data for the report. </li>
  * <li>Step 2 consists in merging this raw data with a XSL-FO template to give it
  * the presentation information. XSL-FO acts as an intermediate language used 
  * to render the final repor in any format with a last transformation. </li>
  * <li>Step 3 consists on rendering the XSL-FO representtion (the intermediate 
  * language) of the report to the PDF output fromat.</li>
  * <ol>
  * Note that the PDF, will force download. You can override this.
  * 
  * @param DOMDocument   $xslFo    The XSL-FO representation of the processed 
  * report, as we get it just after step 2 in this 3 steps process.
  * @param sfWebResponse $response The Response Object, should be passed all 
  * the way down from the action. So we can change some headers', ContentType
  * to 'application/pdf'.
  * 
  * @see %sf_plugins_dir%/NeatReports/config/sfExportGlobals.yml
  * @return String With the rendered report content. PDF Binary stream returned
  * by ApacheFop.
  */
 public function renderReport(DOMDocument $xslFo, sfWebResponse $response = null)
 {
     $response->setContentType('application/pdf');
     $response->setHttpHeader('Content-Disposition', "attachment; filename=report.pdf");
     $this->_pdfRenderer = new RenderPDFConsummer($xslFo->saveXML());
     return $this->_pdfRenderer->getPdfStream();
 }
开发者ID:backstageel,项目名称:neatReports,代码行数:29,代码来源:RenderPdfSoap.php


注:本文中的sfWebResponse::setHttpHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。