Tag: PHP的

从php中导出excel文件后,excel 2010没有打开

我有一个用php编写的脚本,它使用MIMEtypes将html表导出为ex​​cel。 自2016/07/20以来,excel 2010并没有从我的网站打开更多的文件,我注意到,这是不是从任何其他网站做同样的出口openningforms 这是一个testing代码 <?php header('ContentType : application/vnd.ms-excel'); header('Content-Disposition : attachment;filename=test.xls'); header('Pragma : no-cache'); $out = " <table> <tr> <td>something 1</td> <td>something 2</td> <td>something 3</td> <td>something 4</td> <td>something 5</td> </tr> </table> "; echo $out; ?> 该代码仍在工作,但任何Excel 2010是打开此文件 谢谢

将DBF文件传输到EXCEL

有可能将一个dbf文件转移到excel,然后再转移到php? 有人可以给我的想法或链接? 所以我可以做到这一点? 或者可以有人build议顺利转移DBF文件到PHP? 我试图创build一个学生门户网站,并从他们的登记系统(Visual Fox Pro)中获取一些数据,例如课程表,入学学生,class级列表,学院名单。 我的学生门户没有注册系统,因为他们已经注册了。

用不同的值更新存在表,PHP?

如果值更改,我怎么能更新许多行? 我从包含超过130行的XML文件导出数据,并在我的MYSQL数据库上有相同的数字,我想比较它,如果有新行并插入,更新已更改的行。 注意:插入新行工作正常,但更新不起作用! $query = "SELECT positionid FROM vacant WHERE positionid = '".$position."' and ptitle = '".$ptitle."' and location = '".$location."' and vacantd = '".$vdate."' and candidate = '".$resultcandidate."' and cv = '".$cvtorsaf."'"; $sql = mysql_query($query); if (!$sql) { // add this check. die('Invalid query: ' . mysql_error()); } $recResult = mysql_fetch_array($sql); $existName = $recResult["positionid"]; […]

用PHP生成的.xls文件将保存但不能从IE打开

我正在使用PHPdynamic生成一个表,用户可以下载一个.xls文件。 当使用IE时,点击链接后,popup“您要打开还是保存文件…”对话框。 如果用户保存文件并打开它,则没有问题。 但是,如果用户select“打开”,Excel启动,但它是空的。 没有电子表格。 一切工作正常在Chrome和FF。 这是我正在使用的代码。 <?PHP // filename for download $filename = "filename" . date('M_j_Y') . ".xls"; //create the output $output = //<table> code goes here. //set the header to treat this as an excel file header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); echo $output; exit; ?> […]

引用mysqli_connect.php中断PHPExcel Downloader

我是一个新的开发人员,最近完成了为我的公司编写一个简单的PHP MySQL数据库pipe理系统。 现在我已经完成了它的工作 ,我想要保证它的安全,实现我可以在网上find的所有安全最佳实践(例如:正则expression式,在web目录之外有mysqli_connect.php,在脚本内部有连接string等等)在我上网之前。 我已经编辑了这些代码之外的一些个人信息,并将其replace为它的工作内容,但括号内。 如果可能的话,我不想把它留在网上。 通常情况下,我只能参照mysqli_connect.php来处理数据库,如下所示: require_once ('..\mysqli_connect.php'); 我的DBMS的一个function是“下载到excel”button。 它完美的工作, 但只有当我有直接连接的文件内的连接。 如果我尝试像上面的示例中那样编写连接,Excel文件将显示以下错误消息: Excel cannot open the file 'xyz.xlsx' because the file format or extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file. 当我直接在ExcelDownload.php中写入连接时,Excel文件正确下载。 连接string如下所示: $dbc = @mysqli_connect( '[myhost]', '[myusername]', '[mypassword]', […]

未定义的偏移量2

我试图在php中导入.csv文件,但我得到一个错误undefined offset:2和插入我的数据库中的数据只有0.有人可以帮我或给我线索如何解决这个问题? 这是错误。 更新当我尝试var_dump的结果是.. 这是我的代码 <?php include 'db.php'; if(isset($_POST["Import"])){ echo $filename=$_FILES["file"]["tmp_name"]; if($_FILES["file"]["size"] > 0) { $file = fopen($filename, "r"); while (($emapData = fgetcsv($file, 10000, ",")) !== FALSE) { //It wiil insert a row to our subject table from our csv file` $sql = "INSERT into accounts (`acct_code`, `acct_name`) values('$emapData[1]','$emapData[2]')"; //we are using mysql_query function. it […]

完成之后继续阅读Maatwebsite Excel软件包中的所有行以查找laravel

我正在使用Laravel 5和Maatwebsite Excel软件包来读取和写入Excel文件,但是我不确切地知道如何pipe理下一个情况 public function readExcel(Request $request){ $content = []; Excel::load('file.xls', function($reader){ $content = $reader->get(); }); // do more somethings and return return $content; } 事情是,当我返回$内容,没有什么variables,我有一个想法,$内容有初始值和Excel ::加载仍然没有完成和新的价值的内容没有设置。 谢谢。

在xml中不显示整数的第一个doble零

我使用PHP和MYSQL创build一个XML文件。 当我在记事本++中打开XML文件如下所示的内容: <?xml version="1.0" encoding="UTF-8"?> <products> <item> <price>26000</price> <value>278</value> <code>00101189</code> </item> <item> <price>17000</price> <value>92</value> <code>00101100</code> </item> <item> <price>119000</price> <value>112</value> <code>7228687815233</code> </item> <item> <price>48000</price> <value>400</value> <code>6954851217411</code> </item> </products> 但是,当在Microsoft Excel 2013中打开这个文件时,像这样的内容: 正如您在代码列的第二行所看到的,代码应该是“00101189”,但输出是“101189”。 什么是问题? 我的XML文件或Microsoft Excel?

如何创build基于HTML表格的Excel文件并将其保存在项目目录中

我已经build立了一个HTML表格并在其中加载数据。 我想要做的是,基于包含数据的表创build(或转换)为excel并将excel文件保存在项目目录中。 这是我的HTML表格 <table class='tblNemoList' border='1' cellpadding='3' cellspacing='0' width='100%' style='-fs-table-paginate: paginate;'> $thChanges $trChanges $thMissing $trMissing $thNew $trNew </table> "; $strFilename = "FIM_KnowMore_Report_$DT"; 和Excel转换在这里 header("Pragma: no-cache"); header("Expires: 0"); header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=". $strFilename .".xls"); //gets set inside the report.rpt.php file_put_contents($strFilename, $strBody); 我错过了将其保存在目录中的代码。 你能帮忙吗?

JavaScript xlsxfile upload

我怎样才能做xlsx文件从网页上传到服务器? 我有关于读取Excel文件的问题。 我有一个PHP代码,但我需要从网页上传文件到我的服务器。 因为如果我没有上传,我不能读取文件。 这是我的PHP代码。 在这个代码中,我需要上传文件。 header('Content-Type: text/plain'); if (isset($argv[1])) { $Filepath = $argv[1]; } elseif (isset($_POST['File'])) { $Filepath = $_POST['File']; } else { if (php_sapi_name() == 'cli') { echo 'Please specify filename as the first argument'.PHP_EOL; } else { echo 'Please specify filename as a HTTP GET parameter "File", eg, "/test.php?File=test.xlsx"'; } exit; } […]