在XPath中使用PHP
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在XPath中使用PHP相关的知识,希望对你有一定的参考价值。
I'm using this out of laziness.php is slowing things down here, since it's not as close to C as XPath.
A better solution would be to have an attribute specifically for search purposes (either in upper or lowercase).
$xpath = new DOMXPath($dom); $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPHPFunctions('strtolower'); $query = "/root/item[contains(@name_es,'$term') or contains(php:functionString('strtolower',@name_es),'$term')]"; } else { // fallback without PHP }
以上是关于在XPath中使用PHP的主要内容,如果未能解决你的问题,请参考以下文章
php 使用XPath在PHP中使用简单的运动结果解析器。有关更多信息,请访问http://martinsikora.com/parsing-html-pages-using-xpath
php 使用XPath在PHP中使用简单的运动结果解析器。有关更多信息,请访问http://martinsikora.com/parsing-html-pages-using-xpath