以下是ASP添加網頁快捷方式到電腦桌面的代碼:
<%
Response.ContentType="APPLICATION/OCTET-STREAM"
Response.AddHeader "Content-Disposition","attachment;filename="&"廣州網站建設.url" '生成的文件名字
Response.Write("[InternetShortcut]")&Chr(13)
Response.Write("URL=http://"&host&""&sdir&"")&Chr(13)
Response.Write("IconFile=http://www.kyxcg.com.cn/favicon.ico")&Chr(13) '生成的桌面圖標
Response.Write("IDList=")&Chr(13)
Response.Write("[{000214A0-0000-0000-C000-000000000046}]")&Chr(13)
Response.Write("Prop3=19,2")&Chr(13)
Response.End
%>
如果是PHP添加網頁快捷方式到電腦桌面的則是下面的代碼:
<?php
if(isset($_GET[title]) && trim($_GET[title]) !== "") $title = trim($_GET[tilte]);
$content='
[DEFAULT]
BASEURL=http://www.kyxcg.com.cn/
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
[InternetShortcut]
URL=http://www.kyxcg.com.cn/
IDList=[{000214A0-0000-0000-C000-000000000046}]
IconFile=http://www.kyxcg.com.cn/favicon.ico
IconIndex=1
HotKey=0
Prop3=19,2';
header("Content-type:application/octet-stream");
header("Content-Disposition:attachment; {$title}.url;");
echo $content;
?>