0
我做这个教程,但有diferent XML http://blog.insicdesigns.com/2009/03/parsing-xml-file-using-codeigniters-simplexml-library/,但我不断收到同样的错误:遇到 一个PHP错误 严重性:注意 消息:未定义的变量:myxml 文件名:控制器/的welcome.php 线编号:45php与codeigniter中的file_get_contents错误?
这是我的mi代码:我把xml文件放在目录C:\ Users \ beto \ Documents \ xml \ myxml.xml中,但我认为我错了,你能帮我吗,还是告诉我如何解决它?
function _getXML($fname)
{
$filename = $fname.’.xml’;
$xmlfile=“C:\\Users\\beto\\Documents\\xml”.$filename;
**$xmlRaw = file_get_contents($xmlfile);**ERROR
$this->load->library(‘simplexml’);
$xmlData = $this->simplexml->xml_parse($xmlRaw);
foreach($xmlData[‘Emisor’] as $row)
{
$result .= ‘<tr>’;
$result .= ‘<td>’.$row[‘id’].’</td>’;
$result .= ‘<td>’.$row[‘name’].’</td>’;
$result .= ‘<td>’.$row[‘category’].’</td>’;
$result .= ‘<td>$ ‘.$row[‘price’].’</td>’;
$result .= ‘</tr>’;
}
return $result;
}
您应该显示控制器/的welcome.php和线路45有 – 2010-11-24 23:28:25
是说** $ xmlRaw =的file_get_contents($ XMLFILE)行; **错误 – bentham 2010-11-24 23:43:35