溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

ASP和PHP如何實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面

發(fā)布時(shí)間:2021-06-25 14:41:06 來源:億速云 閱讀:196 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹ASP和PHP如何實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

在網(wǎng)站上設(shè)置“加入收藏、設(shè)為首頁(yè)”等按鈕是一般網(wǎng)站都會(huì)干的事兒,但是有的網(wǎng)站還有“放到桌面”這樣的功能設(shè)置。
下面即生成快捷方式并下載到桌面的php實(shí)現(xiàn)代碼,摘錄修改于網(wǎng)絡(luò),僅作參考

php實(shí)現(xiàn)代碼:

<?php
if(isset($_GET[title]) && trim($_GET[title]) !== "") $title = trim($_GET[tilte]);
$content='
[DEFAULT]
BASEURL=https://www.jb51.net/?desktop
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=https://www.jb51.net/?desktop
IDList=[{000214A0-0000-0000-C000-000000000046}]
IconFile=https://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)代碼:

<%
id = int(request("id"))
if id="" then id="1"
title = request("title")
if title="" then title="億速云"
Shortcut = "[DEFAULT]" & vbCrLf
Shortcut = Shortcut & "BASEURL=https://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=https://www.jb51.net/?desktop" & vbCrLf
Shortcut = Shortcut & "IDList=[{000214A0-0000-0000-C000-000000000046}]" & vbCrLf
Shortcut = Shortcut & "IconFile=https://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í)訪問流量。

以上是“ASP和PHP如何實(shí)現(xiàn)生成網(wǎng)站快捷方式并下載到桌面”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI