0
我得到这个消息告诉了XML没有被发现,但然后我得到的产品ID,产品名称,我不知道我是怎么能解决这个问题,请大家帮我找不到和codeigniter的xml?
/*文件结束的welcome.php //地点:./system/application/controllers/welcome.php * /文件“C:\用户\阿毛里\文件\ XML \ myxml.xmlwas没有找到 产品ID产品名称类别价格
这是我的代码:
function _getXML($fname)
{
$filename = $fname.'.xml';
$xmlfile="“C:\\Users\\beto\\Documents\\xml\\".$filename;
//$xmlRaw = file_get_contents($xmlfile);
$result = '';
//$this->load->library('simplexml');
//$xmlData = $this->simplexml->xml_parse($xmlRaw);
if(file_exists($xmlfile)){
$xmlRaw = file_get_contents($xmlfile);
$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>';
}
}else{
$result = 'File' . $xmlfile . 'was not found';
}
return $result;
}
即使我改变目录我得到相同的结果$ xmlfile =“”C:\ Users \ beto \ Documents \ xml \ myxml.xml“。 – bentham 2010-11-25 02:20:59