私はこのような xml ドキュメントを持っています (実際の xml は大きいため、単なる例です):
<document>
<vol>
<sens>A</sens>
<date_vol>2013-05-26 00:00:00</date_vol>
<compagnie>AZA</compagnie>
<num_vol>802</num_vol>
<destination>FCO</destination>
<horaire>1900-01-01 00:20:00</horaire>
<statut>ARRIVE 00:45</statut>
</vol>
<vol>
<sens>A</sens>
<date_vol>2013-05-27 00:00:00</date_vol>
<compagnie>AZA</compagnie>
<num_vol>802</num_vol>
<destination>FCO</destination>
<horaire>1900-01-01 00:20:00</horaire>
<statut>ARRIVE 00:13</statut>
</vol>
次のようにphpを使用してこのドキュメントをクエリしたいと思います:
$simpleXml = new SimpleXMLElement($xml);
$vols = $simpleXml->xpath("/document/vol[sens='$sens_vols' and date_vol='2013-05-26 00:00:00' and horaire>'1900-01-01 00:20:00']");
これは機能しません。空白の結果が得られますが、クエリから最後の and を削除すると (this: and horaire>'1900-01-01 00:20:00') 機能し、どこかに問題があると思います私のコードでは、「=」で機能するため、「>」記号で文字列を照会すると. 誰かが何が悪いのか教えてもらえますか? ありがとう