mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
121 lines
4.6 KiB
HTML
121 lines
4.6 KiB
HTML
<!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-string" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">highlight_string</h1>
|
||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">highlight_string</span> — <span class="dc-title">字符串的语法高亮</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.highlight-string-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>highlight_string</strong></span>
|
||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$str</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="simpara">
|
||
使用PHP内置的语法高亮器所定义的颜色,打印输出或者返回输出或者返回语法高亮版本的PHP代码。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.highlight-string-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">str</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
需要高亮的PHP代码,应当包含开始标签。
|
||
</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-string-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 examples" id="refsect1-function.highlight-string-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-4540">
|
||
<p><strong>Example #1 <span class="function"><strong>highlight_string()</strong></span> 例子</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br />highlight_string</span><span style="color: #007700">(</span><span style="color: #DD0000">'<?php phpinfo(); ?>'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程会输出:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
<code><span style="color: #000000">
|
||
<span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span>
|
||
</span>
|
||
</code>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.highlight-string-notes">
|
||
<h3 class="title">注释</h3>
|
||
<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>
|
||
<p class="para">
|
||
产生的 HTML 标记可能会有更改。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.highlight-string-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="highlight_file.html" class="function" rel="rdfs-seeAlso">highlight_file()</a> - 语法高亮一个文件</span></li>
|
||
<li class="member"><a href="misc.configuration.html#ini.syntax-highlighting" class="link">高亮 INI 指令</a></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |