2016-07-06 99 views
0

我安装了一个脚本,当我登录到管理仪表板正在此错误:XML文件加载错误

Warning (2): simplexml_load_file(): /app/Plugin/PaypalAdaptive/info.xml:7: parser error : xmlParseEntityRef: no name [APP/Controller/PluginsController.php, line 1151]

我检查的文件pluginscontroller.php这是代码。我从整个文件的一部分复制。

线1151是:$xml = simplexml_load_file($file);

的完整代码从这里开始:

 // get all installed plugins 
     $plugins = $this->Plugin->find('all', array(
      'order' => 'id DESC' 
     )); 

     $totalNewVersion = 0; 
     if($plugins != null) 
     { 
      foreach($plugins as $k => $plugin) 
      { 
       $plugin = $plugin['Plugin']; 
       $file = sprintf(PLUGIN_INFO_PATH, $plugin['key']); 
       if(file_exists($file)) 
       { 
        $xml = simplexml_load_file($file); 
        if($xml != null && isset($xml->version)) 
        { 
         if((string)$xml->version > $plugin['version']) 
         { 
          $totalNewVersion += 1; 
         } 
        } 
       } 
      } 
     } 
     return $totalNewVersion; 
    } 

    public function admin_do_upgrade($id) 
    { 
     if(!$this->Plugin->hasAny(array('id' => $id))) 
     { 
      $this->Session->setFlash(__('This plugin does not exist'), 'default', array('class' => 'Metronic-alerts alert alert-danger fade in')); 
     } 
     else 
     { 
+0

请在显示读取时显示生成此错误的最小XML文件。 –

+0

在将xml加载到php文件时可能出现['xmlParseEntityRef:no name'警告]的副本(http://stackoverflow.com/questions/7604436/ xmlparseentityref-no-name-warnings-while-loading-xml-into-a-php-file) – Devon

回答

0

它告诉你的XML是无效的,可能是因为它包含了应该被转义为&的“&”字。

做什么你会做任何错误的商品 - 发回给供应商,并告诉他们修复它。

+0

好的,谢谢我会联系脚本卖家。 – Haf833

0

我终于解决了,我在代码中做了一些修改,并用"&"代替"&"那是什么原因造成的问题。