用把ZIP流轉換成byte類型,之后用PHP的ZIP解壓方法讀取?;蛘咦尫掌鞫藙e用ZIP壓縮數據,就直接傳遞數據,也沒多少時間

創新互聯成立10年來,這條路我們正越走越好,積累了技術與客戶資源,形成了良好的口碑。為客戶提供成都網站建設、成都網站設計、網站策劃、網頁設計、域名申請、網絡營銷、VI設計、網站改版、漏洞修補等服務。網站是否美觀、功能強大、用戶體驗好、性價比高、打開快等等,這些對于網站建設都非常重要,創新互聯通過對建站技術性的掌握、對創意設計的研究為客戶提供一站式互聯網解決方案,攜手廣大客戶,共同發展進步。
你好!你所提出的三個問題.我沒怎麼看懂.如果以第二個為主.我倒可以說說我的看法.
一.如何把數據賦到excel中?
答:sorry.沒怎麼明白.見諒.
二.導出為excel表?
答:有兩種方法實現.1.phpexcel.(稍顯復雜)
2.簡單的(我講這個.簡單^_^)直接上代碼.自己改一下名字
和字段名.就成.
?php
error_reporting(0);
//屏蔽警告和NOTICE等所有提示.包括error
Header(
"Content-type:
application/octet-stream
");
Header(
"Accept-Ranges:
bytes
");
Header(
"Content-type:application/vnd.ms-excel;charset=Big5");
//此處寫編碼,如,UTF-8....
Header(
"Content-Disposition:attachment;filename=abnormal_Report.xls
");
//自己寫文件名
*.xls
require
"conn_mysql.php";
//連接mysql
$sql
=
"select
*
from
`netart`.`abnormal_records`
order
by
record_abtime
desc";
$result
=
mysql_query($sql,$conn);
echo
"table
width='100%'
border='1'
";
echo"tr";
echo
"td
style='color:red'
font
size=4
ID
/font/td";
echo
"td
style='color:red'
font
size=4異常時間
/font/td";
echo
"td
style='color:red'
font
size=4異常地點
/font/td";
echo
"td
style='color:red'
font
size=4詳細內容
/font/td";
echo
"td
style='color:red'
font
size=4提交人
/font/td";
echo
"td
style='color:red'
font
size=4提交時間
/font
/td";
echo
"/tr";
while
($rs=mysql_fetch_array($result)){
echo
"tr";
echo
"td
width='30'
{$rs['record_id']}/td";
//用width
控制表格的寬度.自己改變.
echo
"td
width='150'
{$rs['record_abtime']}/td";
echo
"td
width='80'
{$rs['record_abplace']}/td";
echo
"td
width='700'
{$rs['record_content']}
/td";
echo
"td
width='60'
{$rs['record_username']}
/td";
echo
"td
width='120'
{$rs['record_uptime']}
/td";
echo
"/tr";
}
echo
"/tbale";
?
//以上代碼.自己去改一下名字.和字段名就可以運行了.
==========================================================================
下面的代碼針對MSSQL:(基本跟
Mysql一樣啦.只是改用了ODBC)
?php
error_reporting(0);
Header(
"Content-type:
application/octet-stream");
Header(
"Accept-Ranges:
bytes
");
Header(
"Content-type:application/vnd.ms-excel;charset=Big5");
Header(
"Content-Disposition:attachment;filename=Syslog_view.xls
");
require
"conn_mssql.php";
session_start();
$flag1=@$_SESSION['flag_1'];
$flag2=@$_SESSION['flag_2'];
$flag3=@$_SESSION['flag_3'];
$content=@$_SESSION['content'];
$ip=@$_SESSION['ip'];
$content_2=@$_SESSION['content_2'];
$ip_2=@$_SESSION['ip_2'];
$time=@$_SESSION['time'];
if($flag1==1)
{
$sql_s="select
SysLog.DateTime,SysLog.IP,SysLog.Message
from
NetPerfMon.dbo.SysLog
where
IP='$ip'
and
convert(varchar(10),DateTime,120)='$time'
order
by
DateTime
desc";}
if($flag2==2)
{
$sql_s="select
SysLog.DateTime,SysLog.IP,SysLog.Message
from
NetPerfMon.dbo.SysLog
where
IP='$ip'
and
convert(varchar(10),DateTime,120)='$time'
order
by
DateTime
desc";}
if($flag3==3)
{$sql_s="select
SysLog.DateTime,SysLog.IP,SysLog.Message
from
NetPerfMon.dbo.SysLog
where
IP='$ip'
and
Message
like
'%$content%'
and
convert(varchar(10),DateTime,120)='$time'
order
by
DateTime
desc";}
$res=odbc_do($link,$sql_s);
echo
"table
width='100%'
border='1'";
echo"tr";
echo
"td
style='color:red'
font
size=4
DateTime
/font/td";
echo
"td
style='color:red'
font
size=4
Switch
IP
/font/td";
echo
"td
style='color:red'
font
size=4
Content/font/td";
echo
"/tr";
while
($rs=odbc_fetch_array($res))
{
echo
"tr";
echo
"td
width='130'
{$rs['DateTime']}/td";
echo
"td
width='110'
{$rs['IP']}/td";
echo
"td
width='800'
{$rs['Message']}/td";
echo
"/tr";
}
echo
"/tbale";
session_stop();
?
三.壓縮成文件下載到本地?
答:此處也沒怎麼明白.因為,你做個按鈕/鏈接至上面的代碼.不就可以保存成excel到本地了..還要做什麼壓縮呢.
綜:回答完畢.希望能幫到你.
php壓縮/解壓縮支持zip格式,只要你的java壓縮/解壓縮也是這種格式,兩者相互識別不存在問題。
至于php壓縮/解壓縮有內置的方法,也有第三方的插件,這個你可以百度自己搜索下。
gzinflate 是解壓 gzdeflate 數據的啊,現在是想壓縮后和 java deflate 壓縮的數據一致。又看了下資料,java Deflater(int level,boolean nowrap) 壓縮,如果參數 'nowrap' 為 true,則不使用 ZLIB 頭和校驗和字段,默認好像是 false。而采用 PHP gzencode ($data , -1, FORCE_DEFLATE ) 進行壓縮,只是帶了zlib headers 信息,沒有帶 crc32 checksum,可能問題就在這兒,但是還不知道怎么解決,還請好心的版主給點建議!
本文題目:php無損壓縮數據 PHP壓縮
分享網址:http://www.yijiale78.com/article6/hhigog.html
成都網站建設公司_創新互聯,為您提供網站設計、外貿網站建設、搜索引擎優化、移動網站建設、定制開發、微信公眾號
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯