演示地址:http://www.kaixin001.com/interface/shortcut.php
- public function shortcutAction(){$this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender( true );$url = site_url();$Shortcut = ”[InternetShortcut]
- URL=”.$url.”IDList=IconIndex=43IconFile=/favicon.icoHotKey=1626[{000214A0-0000-0000-C000-000000000046}]Prop3=19,2″;Header(“Content-type: application/octet-stream”);header(“Content-Disposition: attachment; filename=開心網.url”);echo $Shortcut;
- }
[ASP方法]
演示地址:如:http://zhaijixin.com/shorturl.asp
就會有提示下載一個名爲 宅急信-青城最及時的房屋信息網.url 文件,保存在本地就是一個快捷方式!
1、將下面的代碼保存爲文件,shorturl.asp。記得修改第二行及第四行內的url名稱和網址。
<%
Response.ContentType=”APPLICATION/OCTET-STREAM”
Response.AddHeader “Content-Disposition”,”attachment;filename=”&”博士吧設計.url”
Response.Write(“[InternetShortcut]“)&Chr(13)
Response.Write(“URL=http://www.cnarrow.com”)&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
%>
2、將該文件上傳至網站根目錄。
3、在網站根目錄上傳Favicon.ico文件,有這個文件,保存的鏈接纔會有圖標顯示。
4、在網站調用頁面添加如下代碼即可。
<a href=’http://www.boshi8.com/shorturl.asp’>桌面圖標</a>
[PHP方法]
演示地址:http://www.kaixin001.com/interface/shortcut.php
另附PHP代碼,大家可以嘗試一下,保存成shorturl.php即可,調用方式同asp。
<?php
$Shortcut = “[InternetShortcut]
URL=http://www.cnarrow.com/
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 文件 上傳到網站