PHP生成桌面快捷方式就是這麼的簡單,大家生成的時候改下你要生成的網站即可。
dianji.html代碼:
復制代碼 代碼如下:
<a href="a.php?url=www.jb51.net&name=幫客之家">生成左面快捷方式</a>
shengcheng.php代碼:
復制代碼 代碼如下:
<?php
//網站生存左面快捷方式---功能
$url = $_GET['url'];
$filename = urldecode($_GET['name']);
$filename = iconv('GBk','utf-8',$filename);//字符集轉換(沒有需要轉的就不轉)
if (!$url || !$filename) exit();
$Shortcut = "[InternetShortcut]
URL={$url}
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$filename}.url;");
echo $Shortcut;
?>
你要寫一個單獨的頁面來創建快捷方式,我估計你在這之前就有內容在頁面上輸出了,所以抱著個錯
a.php
----------------------------------
$url = $_GET['url'];
$filename = urldecode($_GET['name']);
$filename = iconv('utf-8','GBk',$filename);//字符集轉換
if (!$url || !$filename) exit();
$Shortcut = "[InternetShortcut]
URL={$url}
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
";
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename={$filename}.url;");
echo $Shortcut;
生成的時候做個超鏈接
<a href="a.php?url=網頁地址&name=快捷方式名稱">快捷方式</a>
是一段js代碼,百度搜 JS創建桌面網址快捷方式
html代碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/...al.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
</head>
<body>
<script language="JavaScript">
function toDesktop(sUrl,sName){
try
{
var WshShell = new ActiveXObject("WScript.Shell");
var oUrlLink = WshShell.CreateShortcut(WshShell.SpecialFolders("Desktop") + "\\" + sName + ".url");
oUrlLink.TargetPath = sUrl;
oUrlLink.Save();
}
catch(e)
{
alert("當前IE安全級別不允許操作!");
}
}
</script>
<input name="btn" type="button" id="btn" value="創建網易快捷方式到桌面" onClick="toDesktop('http:\//www.163.com/','網易')">
</body>
</html>