相關(guān)關(guān)鍵詞
關(guān)于我們
最新文章
- PHP中opcode緩存簡(jiǎn)單用法分析
- thinkPHP控制器變量在模板中的顯示方法示例
- PHP move_uploaded_file() 函數(shù)(將上傳的文件移動(dòng)到新位置)
- dirname(__FILE__)的含義和應(yīng)用說明
- thinkPHP5框架實(shí)現(xiàn)分頁(yè)查詢功能的方法示例
- PHP中單雙號(hào)與變量
- PHP獲得當(dāng)日零點(diǎn)時(shí)間戳的方法分析
- Laravel ORM對(duì)Model::find方法進(jìn)行緩存示例詳解
- PHP讀寫文件高并發(fā)處理操作實(shí)例詳解
- 【CLI】利用Curl下載文件實(shí)時(shí)進(jìn)度條顯示的實(shí)現(xiàn)
ASP和PHP實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面的方法
在網(wǎng)站上設(shè)置“加入收藏、設(shè)為首頁(yè)”等按鈕是一般網(wǎng)站都會(huì)干的事兒,但是有的網(wǎng)站還有“放到桌面”這樣的功能設(shè)置。
下面即生成快捷方式并下載到桌面的php實(shí)現(xiàn)代碼,摘錄修改于網(wǎng)絡(luò),僅作參考
PHP代碼實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面
<?php
if(isset($_GET[title]) && trim($_GET[title]) !== "") $title = trim($_GET[tilte]);
$content='
[DEFAULT]
BASEURL=http://www.jb51.net/?desktop
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://www.jb51.net/?desktop
IDList=[{000214A0-0000-0000-C000-000000000046}]
IconFile=http://www.jb51.net/favicon.ico
IconIndex=1
HotKey=0
Prop3=19,2';
header("Content-type:application/octet-stream");
header("Content-Disposition:attachment; {$title}.url;");
echo $content;
?>
ASP代碼實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面
<%
id = int(request("id"))
if id="" then id="1"
title = request("title")
if title="" then title="腳本之家"
Shortcut = "[DEFAULT]" & vbCrLf
Shortcut = Shortcut & "BASEURL=http://www.jb51.net/?desktop" & vbCrLf
Shortcut = Shortcut & "[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf
Shortcut = Shortcut & "Prop3=19,2" & vbCrLf
Shortcut = Shortcut & "[InternetShortcut]" & vbCrLf
Shortcut = Shortcut & "URL=http://www.jb51.net/?desktop" & vbCrLf
Shortcut = Shortcut & "IDList=[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf
Shortcut = Shortcut & "IconFile=http://www.jb51.net/favicon.ico" & vbCrLf
Shortcut = Shortcut & "IconIndex=" & id & vbCrLf
Shortcut = Shortcut & "HotKey=0" & vbCrLf
Shortcut = Shortcut & "Prop3=19,2" & vbCrLf
Response.AddHeader "Content-Dispositon", "attachment;filename=" & title & ".url";
Response.ContetType = "application/octet-steam"
Response.Write Shortcut
%>
其生成原理很簡(jiǎn)單,即將url快捷方式的內(nèi)容強(qiáng)制輸出為附件,當(dāng)訪問時(shí)即下載到了一個(gè)定制的網(wǎng)站快捷方式。但是這個(gè)功能的作用卻可能是很大的,你可以設(shè)置其默認(rèn)圖標(biāo)與如我的電腦、網(wǎng)上鄰居、文件夾等相同,而且因?yàn)樗钦5目旖莘绞?,不?huì)被殺毒軟件等查殺,因此也常被一些黑客行為所使用,以帶來巨大的真實(shí)訪問流量。