This commit is contained in:
fofolee
2019-04-08 23:22:26 +08:00
commit 7ca94f1141
5960 changed files with 530244 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>语法高亮一个文件</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.highlight-file" class="refentry">
<div class="refnamediv">
<h1 class="refname">highlight_file</h1>
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">highlight_file</span> &mdash; <span class="dc-title">语法高亮一个文件</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.highlight-file-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>highlight_file</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$return</code><span class="initializer"> = false</span></span>
] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
<p class="para rdfs-comment">
使用PHP内置的语法高亮器所定义的颜色打印输出或者返回 <code class="parameter">filename</code> 文件中语法高亮版本的代码。
</p>
<p class="para">
许多服务器配置了自动高亮 <em class="emphasis">phps</em> 扩展的文件。
比如,访问 <var class="filename">example.phps</var> 会显示语法高亮后的文件。
添加以下一行代码到 <var class="filename">httpd.conf</var> 使此生效:
</p>
<div class="example-contents screen">
<div class="descriptioncode"><pre class="descriptioncode">AddType application/x-httpd-php-source .phps</pre>
</div>
</div>
</div>
<div class="refsect1 parameters" id="refsect1-function.highlight-file-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">filename</code></dt>
<dd>
<p class="para">
欲高亮文件的路径。
</p>
</dd>
<dt>
<code class="parameter">return</code></dt>
<dd>
<p class="para">
设置该参数为 <strong><code>TRUE</code></strong> 使函数返回高亮后的代码。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.highlight-file-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
如果 <code class="parameter">return</code> 设置为 <strong><code>TRUE</code></strong>,高亮后的代码不会被打印输出,而是以字符串的形式返回。
高亮成功返回 <strong><code>TRUE</code></strong>,否则返回 <strong><code>FALSE</code></strong>
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.highlight-file-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>4.2.1</td>
<td>
该函数现在也受 <a href="ini.sect.safe-mode.html#ini.safe-mode" class="link">safe_mode</a><a href="ini.core.html#ini.open-basedir" class="link">open_basedir</a> 的限制和影响。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.highlight-file-notes">
<h3 class="title">注释</h3>
<div class="caution"><strong class="caution">Caution</strong>
<p class="para">
应当注意在使用 <span class="function"><strong>highlight_file()</strong></span> 时,确认没有在不经意间泄漏敏感信息,类似密码或者其他任何具有潜在安全风险的信息。
</p>
</div>
<blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">当使用了<code class="parameter">return</code>
参数时,本函数使用其内部输出缓冲,因此不能在
<span class="function"><a href="ob_start.html" class="function">ob_start()</a></span> 回调函数的内部使用。</p></p></blockquote>
</div>
<div class="refsect1 seealso" id="refsect1-function.highlight-file-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="highlight_string.html" class="function" rel="rdfs-seeAlso">highlight_string()</a> - 字符串的语法高亮</span></li>
<li class="member"><a href="misc.configuration.html#ini.syntax-highlighting" class="link">Highlighting INI 指令</a></li>
</ul>
</p>
</div>
</div></div></div></body></html>