我有CodeIgniter控制器在服务器上创建Excel文件,并使用提交表单方法在Web上运行良好,如何从我的IONIC运行或执行它控制器。?
在我的代码点火器控制器下面,
function excel_kpa(){
$kat2='KPA_K';
$kat2b='KPA_P';
$nik=$this->input->post('hdNik'); //from submit form
$nama=$this->input->post('hdNama'); //from submit form
$varJawab1 = $this->m_master_indikator->get_hasil_bobot($nik, 1, $kat2);
$varJawab23 = $this->m_master_indikator->get_hasil_bobot($nik, 23, $kat2);
$this->load->library('Excel');
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load("template/kpa.xlsx");
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('M5', $varJawab1)
->setCellValue('M31', $varJawab23);
//ob_end_clean();
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $nama . '-' . $nik . '.xlsx' . '"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
}
谢谢
答案 0 :(得分:0)
你可以使用$ http。
方法: -
1)
app.controller("mycontroller",function($scope,$http){
$http.post("www.google.com",{page:'akjbd',state:'true'}).then(function(res){
console.log(res.data); // it will print result from url
})
});
2)
app.controller("mycontroller",function($scope,$http){
$http.get("www.google.com?page=akjbd&state=true").then(function(res){
console.log(res.data); // it will print result from url
})
});
谢谢.......