Tag: PHP的

PHPExcel_Calculation_Exception:10!I9 – >公式错误:意外,

我想上传一个多页excel文件。 我的代码是这样的 Excel::load($file_path, function($sheet) { $detail = $sheet->get(); var_dump($detail); }); 但我得到以下错误 PHPExcel_Calculation_Exception:10!I9 – >公式错误:意外, 从字面上看,我没有在该文件中的任何其他代码。 更新 我的第一分析是文件中有错误。 然后我改变了我的代码 Excel::filter('chunk')->load($file_path, function($reader) use($file,&$detail) { foreach ($reader->get() as $sheet) { // $sheetTitle = $sheet->getTitle(); foreach($sheet->toArray as $row) { } } }); 一些如何工作,但在列显示为null 55 => Maatwebsite\Excel\Collections\CellCollection {#7429 #title: null #items: array:1 [ 0 => null ] } 56 => […]

如何下载现有的PDF,Excel和Txt文件在Codeigniter中?

我上传了服务器上的文件,我想下载button点击。 但是我用下面的代码尝试过,它只能在图像文件上工作。 不在其他扩展名,如pdf,xlsx,txt,docx等。 我应该怎么做,下载所有的扩展。 这是我的查看代码。 <a href="{base_url('CustomerInformDetailEditController/fileDownload/')}{$row->file_path}{$row->file_name}">Download</a> 这是我的控制器代码。 function fileDownload(){ $this->load->helper('download'); $filename = urldecode($this->uri->segment(5)); $filepathName = file_get_contents(base_url(). $this->uri->segment(3) . "/" . $this->uri->segment(4) . "/" . $filename); echo $filepathName; force_download($filename, $filepathName); }

修改请求SQL

我有一个表SQL,我从一个Excel文件填充它。 问题在于许多领域是重复的。 例如: FOURNITURE MFC SERIE FOURNITURE MFC SERIE FOURNITURE MFC SERIE 在我的桌子上,我只find一行。 它跳了所有的rest。 但是,我需要得到所有的线路。 我的要求是: if ($articleid == 'DIEPRESTATION' || $articleid == 'DIEDIVBIEN' ||$articleid =='DIEDIVERS') { if(!($this->_db->query("INSERT INTO `article` (`ID_Article`, `Designiation`, `Ident`, `ID_LRU`) VALUES ('".$articleid."', '".$designation."', '".$ident."', '".$IdLRU."');"))) { if ($LRU != 'new') { return $this->_db->query(" UPDATE `FLOOSE`.`article` SET `ID_LRU` = '".$IdLRU."' WHERE `article`.`ID_Article` […]

错误:在使用PHP将mysqli查询结果导出到excel中

我想MySQL的查询结果到Excel中,因此我写了下面的PHP脚本: <?php $conn = mysqli_connect('localhost','root','xyz','abc'); $select = "SELECT * FROM table_name"; $export = mysqli_query( $conn,$select) or die ( "Sql error : " . mysqli_error($conn) ); $fields = mysqli_num_rows ( $export ); for ( $i = 0; $i < $fields; $i++ ) { //But this line giving error continuously $header .= mysqli_fetch_field_direct($export,$i) . "\t"; } while( […]

如何导出,然后在php中用后台下载ajax调用的excel文件

我必须导出excel格式的大文件并下载它。 我正在使用PHP的Excel。 文件非常大,所以需要花费很多时间才能导出 。 所以我使用asynchronousAJAX调用,并在服务器端,我使用session_write_close。 通过这我可以发送并发calls.this工作正常,如果我留在同一页面…但是当我发送ajax调用导出和下载文件,然后我redirect到一个新的页面,然后完成该ajax调用ajax调用被取消,无法下载文件。 即使在用户被redirect到一个新的URL后,我如何导出一个文件,然后下载它。

在Excel中查看多个HTML表格时,无法设置TD宽度

你好,我写PHP头来下载excel。 如果我有一个表,我可以通过使用width属性来成功设置<td>的宽度 但如果我有两个表,它不工作。 我怎么办? 因为我需要在我的Excel页面文件多个表 <?php header("Content-Type: application/vnd.ms-excel; charset=TIS-620"); header('Content-Disposition: attachment; filename="report_schedule_teacher.xls"');#ชื่อไฟล์ ?> <html> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=TIS-620" /> </head> <body> <table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;"> <thead> <tr> <td width="300">Hello1</td> <td width="400">Hello2</td> </tr> </thead> <tbody> <tr> <td>World1</td> <td>World2</td> </tr> </tbody> </table> <table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;"> <thead> <tr> <td width="300">Why I cannot set width […]

Laravel导出数据到Excel文件需要修改

我想从表中下载2个用户的数据,我想生成这个数据的excel文件。 这里只有一个名为registerdetails的数据表的下载function。 public function export(){ $items = registerdetails::all(); Excel::create('General Trainee Details', function($excel) use($items){ $excel->sheet('Sheet 1', function($sheet) use($items){ $sheet->fromArray($items); }); })->export('xlsx'); } 我需要修改控制器从registerdetails和bankdetails获取数据。 如果有人能帮我解决这个问题?

phpexcel – 下载文件被损坏

我正在尝试下载由phpexcel生成的excel文件。 我正在使用phpexcel示例“简单下载xlsx”。 我在这个SO问题中使用了相同的概念。 我正在通过来自客户端的POST请求调用php文件。 不通过任何标题。 使用下面的代码: MessageService.invokePostRequest( "/rest/testphpexcel1.php", function(returnedResponse){ var data_type = 'application/vnd.ms-excel'; var excelDoc = new Blob([returnedResponse], { type: data_type }); var url = window.URL.createObjectURL(excelDoc); var exportLink = new core.Element('a'); exportLink.setAttribute('href', url); exportLink.setAttribute('download', this.filename + '.xlsx'); exportLink.trigger('click'); //adding some delay in removing the dynamically created link solved the problem in FireFox setTimeout(function() { window.URL.revokeObjectURL(url); […]

PHP通过echo发送0字节的excel文件

我正在使用MySQL数据库中的数据在单个string$ output中创build一个非常大的表。 在PHP脚本的最后,我发送了两个头文件: header("Content-type: application/msexcel"); header("Content-Disposition: attachment; filename=action.xls"); 问题是当大桌子有大约55000行时。 发生这种情况时,发送的文件是0字节,用户打开一个空文件。 我通过这个标题后发送文件: echo $output; 当表没有太多的行时,文件发送工作。 如何以这种方式发送文件,string$输出的大小并不重要?

如何从Laravel的当前search中导出数据到excel?

我的项目有问题,我需要从Laravel的search数据中导出我的表,我怎么能做到这一点先生? 有我的控制器和index.blade.php Controller.php这样 public function downloadExcel(Request $request, $type) { $data = TABLENAME::get()->toArray(); return Excel::create('FILENAME', function($excel) use ($data) { $excel->sheet('mySheet', function($sheet) use ($data) { $sheet->fromArray($data); }); })->download($type); } public function search(Request $request) { $query = Model_items::query(); if(Input::has('name')) { $query->where('name', $getName); } if(Input::has('phone')) { $query->where('phone', $getPhone); } $dataList = $query->paginate(10); return view('index', compact('dataList')); } Index.blade.php <div class="col-md-4"> […]