function.xslt-set-log.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 123 行

HTML
123
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Set the log file to write log messages to</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-set-error-handler.html">xslt_set_error_handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-set-object.html">xslt_set_object</a></div> <div class="up"><a href="ref.xslt.html">XSLT Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.xslt-set-log" class="refentry"> <div class="refnamediv">  <h1 class="refname">xslt_set_log</h1>  <p class="verinfo">(PHP 4 &gt;= 4.0.6)</p><p class="refpurpose"><span class="refname">xslt_set_log</span> &mdash; <span class="dc-title">Set the log file to write log messages to</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type"><span class="type void">void</span></span> <span class="methodname"><b><b>xslt_set_log</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$xh</tt></span>   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <tt class="parameter">$log</tt></span>  ] )</div>  <p class="para rdfs-comment">   This function allows you to set the file in which you want XSLT log   messages to, XSLT log messages are different than error messages, in   that log messages are not actually error messages but rather messages   related to the state of the XSLT processor. They are useful for   debugging XSLT, when something goes wrong.  </p>  <p class="para">   By default logging is disabled, in order to enable logging you must   first call <b>xslt_set_log()</b> with a boolean parameter   which enables logging, then if you want to set the log file to debug to,   you must then pass it a string containing the filename.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">xh</tt></i></span>     <dd>      <p class="para">       The XSLT processor link identifier, created with       <a href="function.xslt-create.html" class="function">xslt_create()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">log</tt></i></span>     <dd>      <p class="para">       This parameter is either a boolean value which toggles logging on and       off, or a string containing the logfile in which log errors too.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   No value is returned.  </p> </div> <div class="refsect1 notes">  <h3 class="title">Notes</h3>  <blockquote><p><b class="note">Note</b>: Please note that<i>file://</i> is needed in front of the path when using Windows.<br /></p></blockquote> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 Using the XSLT Logging features</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$xh&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xslt_create</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">xslt_set_log</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">xslt_set_log</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">getcwd</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">'/myfile.log'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">xslt_process</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'dog.xml'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'pets.xsl'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$result</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">xslt_free</span><span style="color: #007700">(</span><span style="color: #0000BB">$xh</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xslt-set-error-handler.html">xslt_set_error_handler</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xslt-set-object.html">xslt_set_object</a></div> <div class="up"><a href="ref.xslt.html">XSLT Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?