当前位置:首页 > PHP教程 > PHP高级教程

用php或asp创建网页桌面快捷方式的代码

新建一个php文档:名字好记就行如:shortcut.php
php文档中的内容:
代码
复制代码 代码如下:

<?php
$shortcut = "[internetshortcut]
url=http://www.jb51.net/
idlist=
[{000214a0-0000-0000-c000-000000000046}]
prop3=19,2
";
header("content-type: application/octet-stream");
header("content-disposition: attachment; filename=硕编程.url;");
echo $shortcut;
?>

要想出现图标请先确保网站根目录中有 favicon.ico 文件
上传到网站,访问地址:如:http://www.jb51.net/shortcut.php 就会有提示下载一个名为 硕编程.url文件,保存在本地就是一个快捷方式!
下面是asp实现代码:
复制代码 代码如下:

<%
id=int(request("id"))
if id="" then id="1"
title=request("title")
if title="" then title="硕编程"
shortcut = "[internetshortcut] " & vbcrlf
shortcut = shortcut & "url=http://www.jb51.net/article/"&id&".htm?desktop" & vbcrlf
shortcut = shortcut & "idlist= " & vbcrlf
shortcut = shortcut & "[{000214a0-0000-0000-c000-000000000046}] " & vbcrlf
shortcut = shortcut & "prop3=19,2 " & vbcrlf
shortcut = shortcut & " " & vbcrlf
response.addheader "content-disposition", "attachment;filename="&title&".url;"
response.contenttype = "application/octet-stream"
response.write shortcut
%>


需要注意的是,因为可能安全问题导致被锁定
需要如下操作,在"硕编程.url"--》右键--》属性--》解除锁定 即可访问,这个就像网上下载的chm文件一样需要类似的操作。
 

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐