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


PHP Settings::setOutputEscapingEnabled方法代码示例

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


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

示例1: basename

use PhpOffice\PhpWord\Settings;
date_default_timezone_set('UTC');
error_reporting(E_ALL);
define('CLI', PHP_SAPI == 'cli' ? true : false);
define('EOL', CLI ? PHP_EOL : '<br />');
define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
define('IS_INDEX', SCRIPT_FILENAME == 'index');
Settings::loadConfig();
// Set writers
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf');
// Set PDF renderer
if (null === Settings::getPdfRendererPath()) {
    $writers['PDF'] = null;
}
// Turn output escaping on
Settings::setOutputEscapingEnabled(true);
// Return to the caller script when runs by CLI
if (CLI) {
    return;
}
// Set titles and names
$pageHeading = str_replace('_', ' ', SCRIPT_FILENAME);
$pageTitle = IS_INDEX ? 'Welcome to ' : "{$pageHeading} - ";
$pageTitle .= 'PHPWord';
$pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
// Populate samples
$files = '';
if ($handle = opendir('.')) {
    while (false !== ($file = readdir($handle))) {
        if (preg_match('/^Sample_\\d+_/', $file)) {
            $name = str_replace('_', ' ', preg_replace('/(Sample_|\\.php)/', '', $file));
开发者ID:matiasvillanueva,项目名称:laravel5-CRUD-LOGIN,代码行数:31,代码来源:Sample_Header.php

示例2: file_get_contents

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$TAITAN = 'https://taitan.datasektionen.se';
$ME_URL = $_ENV['APP_URL'] . "?path=";
$json = file_get_contents($TAITAN . $_GET['path']);
//$json = mb_convert_encoding($json , 'HTML-ENTITIES', "UTF-8");
$obj = json_decode($json);
$file = $obj->title . '.docx';
header("Content-Description: File Transfer");
header('Content-Disposition: inline; filename="' . $file . '"');
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Expires: 0');
#$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
#$xmlWriter->save("php://output");
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
// New Word document
// New section
$section = $phpWord->addSection();
// Define styles
$phpWord->addTitleStyle(1, array('size' => 35, 'bold' => true, 'color' => '#e83d84'));
// Adding Text element with font customized using named font style...
$pStyle = 'p';
$phpWord->addFontStyle($pStyle, array('name' => 'Arial', 'size' => 16, 'color' => '757575', 'bold' => false));
// Arc
$section->addTitle($obj->title, 1);
//$section->addText(htmlspecialchars_decode(strip_tags($obj->body)), $pStyle);
WaffleHtml::addHtml($section, $obj->body);
if ($obj->sidebar) {
    $sidebar = $phpWord->addSection();
    $sidebar->addTitle("Sidebar", 1);
开发者ID:datasektionen,项目名称:nsflh,代码行数:31,代码来源:index.php


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