array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.xml-set-character-data-handler.php', 1 => 'xml_set_character_data_handler', ), 'up' => array ( 0 => 'ref.xml.php', 1 => 'XML 解析器函数', ), 'prev' => array ( 0 => 'function.xml-parser-set-option.php', 1 => 'xml_parser_set_option', ), 'next' => array ( 0 => 'function.xml-set-default-handler.php', 1 => 'xml_set_default_handler', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/xml/functions/xml-set-character-data-handler.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
xml_set_character_data_handler — 建立字符数据处理器
为 parser
变量指向的 XML 解析器指定字符数据处理函数。
parser
XML 解析器。
handler
如果传递 null
或空字符串,处理程序将重置为其默认状态。
如果 handler
是 callable,设置的 callable 将作为处理程序。
如果 handler
是 string,它可以是 xml_set_object()
设置的对象的方法名称。
处理程序的签名必须是:
parser
data
XML 文档的每段文字都会调用字符数据处理程序。可以在每个片段内多次调用(比如非 ASCII 字符串)。
总是返回 true
。