HTML(Codeigniter视图)中的这段代码有什么问题?它应该根据数据库销售发票信息生成一个VML文件。
<?php
$this->load->helper('xml');
$this->load->dbutil();
$this->load->helper('file');
$this->load->database();
$report = $query = $this->db->get('invoices_salesvan_warehouse');
$new_report = $this->dbutil->xml_from_result($report);
write_file(‘xml_file.xml’,$new_report);
?>
答案 0 :(得分:0)
try with
function getDataForXML(){
return $query = $this->db->get('invoices_salesvan_warehouse');
}
function getreport()
{
$this->load->dbutil();
$this->load->helper('file');
$report = $this->getDataForXML();
$new_report = $this->dbutil->xml_from_result($report);
write_file('xmlfile.xml',$new_report);
}