这篇文章主要介绍了PHP实现生成网站快捷方式并下载到桌面的方法,比加入收藏、设为首页更给力哦,需要的朋友可以参考下
在网站上设置“加入收藏、设为首页”等按钮是一般网站都会干的事儿,但来源gaodai#ma#com搞@@代~&码网是有的网站还有“放到桌面”这样的功能设置。
下面即生成快捷方式并下载到桌面的php实现代码,摘录修改于网络,仅作参考
php实现代码:
if(isset($_GET[title]) && trim($_GET[title]) !== “”) $title = trim($_GET[tilte]);
$content=’
[DEFAULT]
BASEURL=https://www.gaodaima.com/?desktop
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=https://www.gaodaima.com/?desktop
IDList=[{000214A0-0000-0000-C000-000000000046}]
IconFile=https://www.gaodaima.com/favicon.ico
IconIndex=1
HotKey=0
Prop3=19,2′;
header(“Content-type:application/octet-stream”);
header(“Content-Disposition:attachment; {$title}.url;”);
echo $content;
?>
asp实现代码:
id = int(request(“id”))
if id=”” then id=”1″
title = request(“title”)
if title=”” then title=”脚本之家”
Shortcut = “[DEFAULT]” & vbCrLf
Shortcut = Shortcut & “BASEURL=https://www.gaodaima.com/?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.gaodaima.com/?desktop” & vbCrLf
Shortcut = Shortcut & “IDList=[{000214A0-0000-0000-C000-000000000046}]” & vbCrLf
Shortcut = Shortcut & “IconFile=https://www.gaodaima.com/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
%>
以上就是ASP和PHP实现生成网站快捷方式并下载到桌面的方法的详细内容,更多请关注gaodaima搞代码网其它相关文章!