我目前正在进行xpath搜索,已经使搜索工作正常,但是我需要使它不区分大小写。 我使用的xml文件是1.0版本,据我的研究,这意味着我必须使用称为“translate function”的东西,但我不确定如何做到这一点。
这是我的搜索文件:
$holidayDoc = simplexml_load_file('holidays.xml');
// fetch data from form
$txtSearch = $_GET['txtSearch'];
$qry = "//channel/item[contains(.,\"$txtSearch\")]";
$holidays = $holidayDoc->xpath($qry); // do the xpath query
// now loop through all the students
echo "Showing title search results for $txtSearch";
foreach ($holidays as $holiday)
{
echo "<p><a href=\"{$holiday->link}\">{$holiday->title}</a></p>
<p><small>$holiday->pubDate</small></p>";
任何帮助都将不胜感激,谢谢。