谁有实际的代码~!
导入只要求一个
<form ENCTYPE="multipart/form-data" ACTION="<?php echo"".$PHP_SELF.""; ?>" METHOD="POST"> 
      <p>导入CVS数据    <input NAME="MyFile" TYPE="file"> <input VALUE="提交" TYPE="submit"> 
      </p>
</form> 导出需要先显示此张表~!在点下按钮就有到处的功能??大家以前做过吗??SOS

解决方案 »

  1.   

    [email protected] 这个可能更好  麻烦大家了~!
      

  2.   

       if($type=="csv"){  
        $filename = time().".csv";
        header("Content-disposition: filename=$filename");
        header("Content-type: unknown/unknown");
        echo "字段,字段,字段,字段,字段,字段";
        while ($row=@mysql_fetch_array($ressult))
        {
            echo base64_decode("DQo=")."\"$row[0]\",\"$row[1]\",\"$row[2]\",\"$row[3]\",\"$row[4]\",\"$row[5]\"";
            /*上式中“base64_decode(\"DQo=\")”是换行符,之所以不用“\n”,是因为两者不完全相同。*/
        }
        die;
        }
        //导出XLS
        if($type=="xls"){    
        $filename = time().".xls";
        header("Content-disposition: filename=$filename");
        header("Content-type: unknown/unknown");
           echo "字段"."\t";
          echo "字段"."\t";
       echo "字段"."\t";
       echo "字段"."\t";
     echo "字段"."\t";
     echo "字段"."\n";
        while ($row = @mysql_fetch_array($ressult))
        {
              echo $row[0]."\t";
       echo $row[1]."\t";
       echo $row[2]."\t";
       echo $row[3]."\t";
              echo $row[4]."\t";
              echo $row[5]."\n";     
        }
        die;
        }
      

  3.   

        header("Content-disposition: filename=test.xls"); 
        header("Content-Type:   application/vnd.ms-excel");   
        header("Pragma:   no-cache");   
        header("Expires:   0"); 
        连接数据库
         $sql = "select * from test";   
        $result = mysql_query($sql);  
        
        echo "字段名0"."\t"; 
        echo "字段名1"."\t"; 
        echo "字段名2"."\t"; 
        echo "字段名3"."\t"; 
        echo "字段名4"."\t"; 
        echo "字段名5"."\n"; 
        while ($row = mysql_fetch_array($ressult)) 
        { 
         echo $row[字段0]."\t"; 
         echo $row[字段1]."\t"; 
         echo $row[字段2]."\t"; 
         echo $row[字段3]."\t"; 
         echo $row[字段4]."\t"; 
         echo $row[字段5]."\n";      
        } 
      

  4.   

    <?//ini_set('display_errors','1'); header("Content-type:Application/vnd.ms-excel"); header("Content-Disposition:filename=excel.xls"); header("Expires: 0"); include_once "dbconn.class.php"; $db=new dbconn; $sql="select * from zs_user"; $result=$db->connection($sql); echo "学校名称"."\t"; echo "用户名"."\t"; echo "密码"."\t"; echo "国标代码"."\n"; while($arr=mysql_fetch_array($result["rs"])){ echo $arr["U_CName"]."\t"; echo $arr["U_EName"]."\t"; echo md5($arr["U_Pass"])."\t"; echo $arr["U_HttpCode"]."\n"; }?> 
      

  5.   

    header("Content-type:Application/vnd.ms-excel"); 
    这是不是要求客户端也支持?