开发者

not found my xml with codeigniter?

I get this message that tell that the xml was not found but then I get product ID, product name, I dont figure out how can I fix that, please help me

/* End of file welcome.php / / Location: ./system/application/controllers/welcome.php */ File“C:\Users\amaury\Documents\xml\myxml.xmlwas not found PRODUCT ID PRODUCT NAME CATEGORY PRICE

This is my code:

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开发者_Go百科 .= '</tr>';
        }
    }else{
        $result = 'File' . $xmlfile . 'was not found';
    }
    return $result;
}


It appears that you have an extra set of curly quotes in your path. "“C:\\

Is that in your actual code? It might be the cause of your issue.

“C:\\Users\\beto\\Documents\\xml\\myxml.xml won't exist, but C:\\Users\\beto\\Documents\\xml\\myxml.xml will.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜