0
我從XML中過濾了整個標題。從xml在php中搜索過濾器
if(isset($_POST["submit"]))
{
$state=$_POST["state"];
$title=$_POST["title"];
$result = simplexml_load_file('sample.xml');
$record = $result-> xpath('(/jobs/job[positiontitle="'.$title.'"])|(/jobs/job[state="'.$state.'"])');
foreach ($record as $row):
$jobid=$row->jobid;
?>
<li class="result">
<a href="<?php print base_path(); ?>job/?<?php print $jobid;?>">
<h3 class="title"><?php $title=$row->positiontitle;
echo $title; ?></h3>
</li>
<?php
endforeach;
?>
這裏我的XML
<jobs>
<job>
<jobid>
<![CDATA[ 02304485 ]]>
</jobid>
<positiontitle>
<![CDATA[ Maintenance Manager ]]>
</positiontitle>
</job>
</jobs>
如果鍵入的標題是「維護」,標題應該是filtered.In SQL我們可以用同樣的操作,進行篩選。這裏應該怎麼做?