php中两种将查询的内容输出写入到一本文本日志中的方法
来源:互联网 发布:蜂鸟网络 编辑:程序博客网 时间:2024/05/10 05:21
<?php
header("Content-Type: text/html; charset=utf-8");
//require_once 'db.class.php';
require_once 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$filePath = "channel.xlsx";
$arr = array();
$temparr = array();
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
$PHPExcel = $PHPReader->load($filePath);
$currentSheet = $PHPExcel->getSheet(0);
/*取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/*取得一共有多少行*/
$allRow = $currentSheet->getHighestRow();
echo $allColumn;
echo '<hr>';
echo $allRow;
echo '<hr>';
$a = array();
$b = array();
$temparr = array();
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
$a[] = hexdec($currentSheet->getCell('A'.$currentRow)->getValue()).'a';
$b[] = $currentSheet->getCell('B'.$currentRow)->getValue();
$c = array_combine($a,$b);
$str = '<?php '.var_export($c,true).' ?>';
fwrite($myfile,$str);
fclose($myfile);
header("Content-Type: text/html; charset=utf-8");
//require_once 'db.class.php';
require_once 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$filePath = "channel.xlsx";
$arr = array();
$temparr = array();
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
$PHPExcel = $PHPReader->load($filePath);
$currentSheet = $PHPExcel->getSheet(0);
/*取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/*取得一共有多少行*/
$allRow = $currentSheet->getHighestRow();
echo $allColumn;
echo '<hr>';
echo $allRow;
echo '<hr>';
$a = array();
$b = array();
$temparr = array();
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
$a[] = hexdec($currentSheet->getCell('A'.$currentRow)->getValue()).'a';
$b[] = $currentSheet->getCell('B'.$currentRow)->getValue();
$c = array_combine($a,$b);
}
方法一;
$str = '<?php '.var_export($c,true).' ?>';
fwrite($myfile,$str);
fclose($myfile);
?>
方法二:
//$str = '<?php return'.var_export($d,true).'?>';
//$str = var_export($c,true);
//file_put_contents("./export1.php",$str);
//echo '<pre>';print_r($c);die;
注意:
var_export -- 输出或返回一个变量的字符串表示
1 0
- php中两种将查询的内容输出写入到一本文本日志中的方法
- 把system.out.println的内容用log4j输出到tomcat日志里方法
- php把用户输入的内容写入文件中的代码
- PHP进阶:写入内容到文件
- 关于PHP+MSSQL查询输出的内容末尾乱码问题!
- nginx php-fpm 输出php错误日志的配置方法
- python中将正则过滤的内容输出写入到文件中
- oracle把查询内容输出到文本
- Shell 命令行 从日志文件中根据将符合内容的日志输出到另一个文件
- flume 模拟将日志内容写入到 hive中
- 在后台日志中写入信息-输出信息到log
- 控制log4j日志不输出到控制台的方法
- Logger 具体到方法的日志输出类
- Log4J输出日志到WEB工程目录的实现方法
- Spring Framework 将日志输出到slf4j的方法
- PHP 输出变量结构信息到日志
- PHP自定义输出日志到文件
- 写入日志到Scribe的解决方案
- eclipse设置debug签名为打包release签名
- 数据库系统实现技术内幕第一次作业
- mac-NTFS
- Redis-30分钟入门
- @RequestBody应用,requestbody
- php中两种将查询的内容输出写入到一本文本日志中的方法
- Hadoop、Hbase、Hive版本兼容性
- Unity动画插件DoTween使用总结(二)
- 应缴类型与月核定
- 接口与抽象类
- PostgreSQL中的表空间
- vmware设置网络连接方式为NAT无法不能上网
- 编程能力提高-----C语言字符串的基本操作
- 修改android开机动画