PHPExcel file storage problems
GetProperties ()-> setCreator ("Maarten Balliauw"); $ objPHPExcel-> getProperties ()-> setLastModifiedBy ("Maarten Balliauw"); $ objPHPExcel-> getProperties () -> setTitle ("Office 2007 XLSX Test Document"); $ objPHPExcel-> getProperties ()-> setSubject ("Office 2007 XLSX Test Document"); $ objPHPExcel-> getProperties () -> setDescription ("Test document for Office 2007 XLSX, generated using PHP classes. "); $ objPHPExcel-> getPro Perties ()-> setKeywords ("office 2007 openxml php"); $ objPHPExcel-> getProperties ()-> setCategory ("Test result file "); $ objPHPExcel-> setActiveSheetIndex (0); $ objPHPExcel-> getActiveSheet ()-> setCellValue ('A1', 'hello1'); $ objPHPExcel-> getActiveSheet () -> setCellValue ('b1 ', 'world2'); $ objPHPExcel-> getActiveSheet ()-> setCellValue ('C1', 'hello3'); $ objPHPExcel-> getActiveSheet () -> setCellValue ('d1 ', 'world4'); $ objPH PExcel-> getActiveSheet ()-> setTitle ('sheet0'); $ objPHPExcel-> setActiveSheetIndex (0); $ phpexcel = PHPExcel_IOFactory: load ("phonelist.xls "); $ sheet = clone $ phpexcel-> getActiveSheet (); $ objPHPExcel-> addExternalSheet ($ sheet); $ objPHPExcel-> removeSheetByIndex (0); $ objPHPExcel-> getActiveSheet () -> removeRow (3); $ objWriter = PHPExcel_IOFactory: createWriter ($ objPHPExcel, 'excel2007 '); $ objWriter-> save (str_replac E ('. php', '.xlsx', _ FILE _); // _ FILE _ => absolute path of an excel FILE?>
In this code, I run the php command to create a file with a suffix of xlsx. however, if I put this code in a file with html tags and open it in Firefox. it cannot be created. why. the modified file content is roughly as follows:
<Br/> number Management System <br/>
Reply to discussion (solution)
Why use form to wrap code?
SetPut it in front of the php code.
Why use form to wrap code?
SetPut it in front of the php code.
I am worried that I cannot find my post. depressed, I cannot find any posts posted by csdn. The problem is solved. it is a permission issue.
Http://blog.csdn.net/cp3alai/article/details/45665283