首页 > fopen

php mysql 数据库备份程序

?>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link type="text/css教程" rel="stylesheet" href="common/control.css">
<script type="text/网页特效" language="javascript" src="common/admin.otable.js"></script>
<script type="text/javascript" language="javascript" src="common/include.func.js"></script>
<title>数据管理</title>
<style type="text/css">
span {padding-left:8px;}
</style>
</head>

阅读全文

PHP文件创建、复制、移动、删除文件

php代码

<?php session_start();
if($submit=="提交"){
$copy=$_post[copys];
$copys2=$_post[copy2];
if(copy($copy,$copys2)==true){echo "复制成功!!";}else{echo "失败!!";};
}
if($submit2=="提交"){
$moves=$_post[moves];
$moves2=$_post[moves2];
if(rename($moves,$moves2)==true){echo "移动成功!!";}else{echo "失败!!";};
}

阅读全文

php mysql 导出csv excel格式文件并保存

$times = time();
 $filename = $times.".csv"; 
 $a = "联系人,联系电话,申请时间 "; 
 
 $days = postget("days");
 
 $mktime = daystomktime($days);
 $sql = "select * from  v_tugou where ($times-times)<$mktime";
 $db = new db();
 $result = $db->query( $sql );
 $rs = $db->fetch($result,0);
 foreach($rs as $v=>$vv)
 {  
 $a.=$vv['name'].','. $vv['mo'].",";
 $a.=date('y-m-d ',$vv['times'])." ";  
 }
 //echo $a;
 $hod = fopen ($filename,"w+");
 if( fwrite($hod,$a) )
 {
  echo "生成excel文件成功,点击<a href=$filename target=_blank>右击另存为excel文档</a>";
 }
 

阅读全文

php写的网页计数器代码

<html>
<head>
<title>php教程写的网页计数器代码</title>
<head>
<body>

<?php
$countfile = "counter.txt";
//定义计数器写入的文件是当前目录下的counter.txt文件中,然后我们应当测试该文件能否打开
if (($fp = fopen($countfile, "r+")) == false) {
 //用读写模式打开文件,若不能打开就退出
 printf ("open file %s failed!",$countfile);
 exit;
}
else
{
//如果文件能够正常打开,就读入文件中的数据,假设是1
$count = fread ($fp,10);
//读取10位数据
$count = $count + 1;
//count ++
fclose ($fp);
//关闭当前文件
$fp = fopen($countfile, "w+");
//以覆盖模式打开文件
fwrite ($fp,$count);
//写入加1后的新数据
fputs($fp,$fg);
//显示计数结果
// 数字显示
echo "<div align=center><font size=5>计数次数:$count</font><br>";

阅读全文

php excel导入mysql

require_once './includes/reader.php';
// excelfile($filename, $encoding);
$data = new spreadsheet_excel_reader();
// set output encoding.
$data->setoutputencoding('gbk');
//"data.xls"是指要导入到mysql中(的)excel文件
$data->read('date.xls');
@ $db = mysql_connect('localhost', 'root', '1234') or
die("could not connect to database.");//连接数据库
mysql_query("set names 'gbk'");//输出中文
mysql_select_db('wenhuaedu'); //选择数据库
error_reporting(e_all ^ e_notice);
for ($i = 1; $i <= $data->sheets[0]['numrows']; $i++) {
//以下注释(的)for循环打印excel表数据
 
for ($j = 1; $j <= $data->sheets[0]['numcols']; $j++) {
echo $data->sheets[0]['cells'][$i][$j].",";
}
echo "n";

阅读全文