function.xml-set-processing-instruction-handler.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 177 行
HTML
177 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Set up processing instruction (PI) handler</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.xml-set-object.html">xml_set_object</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xml-set-start-namespace-decl-handler.html">xml_set_start_namespace_decl_handler</a></div> <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.xml-set-processing-instruction-handler" class="refentry"> <div class="refnamediv"> <h1 class="refname">xml_set_processing_instruction_handler</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">xml_set_processing_instruction_handler</span> — <span class="dc-title"> Set up processing instruction (PI) handler </span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><b><b>xml_set_processing_instruction_handler</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$parser</tt></span> , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.callback" class="type callback">callback</a></span> <tt class="parameter">$handler</tt></span> )</div> <p class="para rdfs-comment"> Sets the processing instruction (PI) handler function for the XML parser <i><tt class="parameter">parser</tt></i>. </p> <p class="para"> A processing instruction has the following format: <div class="informalexample"> <div class="example-contents"><div class="cdata"><pre><?</pre></div><span class="replaceable">target</span> <span class="replaceable">data</span><div class="cdata"><pre>?> </pre></div></div> </div> You can put PHP code into such a tag, but be aware of one limitation: in an XML PI, the PI end tag (<i>?></i>) can not be quoted, so this character sequence should not appear in the PHP code you embed with PIs in XML documents.If it does, the rest of the PHP code, as well as the "real" PI end tag, will be treated as character data. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">parser</tt></i></span> <dd> <p class="para"> </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">handler</tt></i></span> <dd> <p class="para"> <i><tt class="parameter">handler</tt></i> is a string containing the name of a function that must exist when <a href="function.xml-parse.html" class="function">xml_parse()</a> is called for <i><tt class="parameter">parser</tt></i>. </p> <p class="para"> The function named by <i><tt class="parameter">handler</tt></i> must accept three parameters: <div class="methodsynopsis dc-description"> <span class="methodname"><b><span class="replaceable">handler</span></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$parser</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$target</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$data</tt></span> )</div> <dl> <dt> <span class="term"><i><tt class="parameter">parser</tt></i></span> <dd> <span class="simpara"> The first parameter, <span class="replaceable">parser</span>, is a reference to the XML parser calling the handler. </span> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">target</tt></i></span> <dd> <span class="simpara"> The second parameter, <i><tt class="parameter">target</tt></i>, contains the PI target. </span> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">data</tt></i></span> <dd> <span class="simpara"> The third parameter, <i><tt class="parameter">data</tt></i>, contains the PI data. </span> </dd> </dt> </dl> </p> <p class="para"> If a handler function is set to an empty string, or <b><tt>FALSE</tt></b>, the handler in question is disabled. </p> <blockquote><p><b class="note">Note</b>: <span class="simpara">Instead of a function name, anarray containing an object reference and a method name can also besupplied.</span></p></blockquote> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <b><tt>TRUE</tt></b> on success or <b><tt>FALSE</tt></b> on failure. </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.xml-set-object.html">xml_set_object</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.xml-set-start-namespace-decl-handler.html">xml_set_start_namespace_decl_handler</a></div> <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?