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

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

<?php
$Shortcut = "[InternetShortcut]
URL=//www.jb51.net/
IDList=
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2
";
Header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=【宜配屋www.yipeiwu.com】.url;");
echo $Shortcut;
?>

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

<%
id=int(request("id"))
if id="" then id="1"
title=request("title")
If title="" Then title="【宜配屋www.yipeiwu.com】"
Shortcut = "[InternetShortcut] " & vbCrLf
Shortcut = Shortcut & "URL=//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
%>


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

相关文章

php获取url参数方法总结

本文实例讲述了php获取url参数方法。分享给大家供大家参考。具体如下: 在php中获取url中参数的方法有很多种,其中最简单的就直接使用parse_url函数了,他可以很方便快速的自动...

PHP中用接口、抽象类、普通基类实现“面向接口编程”与“耦合方法”简述

复制代码 代码如下: <?php /* 边学边做的,为方便自己翻阅而发布,更为得到高人指点而发布,欢迎高手指点...... 【提示】本例通过测试无误 【情景设计】 模拟计算机主板I...

php短域名转换为实际域名函数

复制代码 代码如下: $url = "http://sinaurl.cn/hbdsU5"; echo unshorten($url); function unshorten($url)...

PHP空值检测函数与方法汇总

几乎任何入口的HTTP请求我们都会去检测它携带的参数,类似 isset() empty() 的函数一定不少见。 以下的测试结果基于 PHP7.16 是否定义判断: isset() 可以...

通过php添加xml文档内容的方法

本文实例讲述了通过php添加xml文档内容的方法。分享给大家供大家参考。具体分析如下: 这里讲述的添加xml文档内容,从上一篇《DOM基础及php读取xml内容操作的方法》继续,代码如下...