您好,这是我拥有的 php:
if (file_exists('movies.xml')) {
$xml = simplexml_load_file('movies.xml');
print $xml->key['Movie'];
}
这是 movies.xml 的样子:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict><dict>
<key>2066</key>
<dict>
<key>ID</key><integer>111</integer>
<key>Year</key><string>2011</string>
<key>Movie</key><string>The beach</string>
<dict>
<key>2068</key>
<dict>
<key>ID</key><integer>112</integer>
<key>Year</key><string>2012</string>
<key>Movie</key><string>Titanic</string>
<dict>
<key>Movie</key>
在这种情况下,我试图获得价值:海滩和泰坦尼克号。(如果可能的话,我想存储在一个数组中)
任何建议我做错了什么?