请问:“开心网”首页的“设为桌面图标”shortcut.php 是怎么实现 在桌面建立快捷方式,而且还是中文名的?

解决方案 »

  1.   

    不知道  不过 用Delphi写个小程序很容易就实现了
      

  2.   

    不就是一个url文件吗?
    你可以这样做
    1、访问你需要生成“桌面图标”的网址,最好是有自定义url图标的那种,将地址栏的图标拖到桌面上
    2、创建一个文件下载的php程序,执行时输出第一步生成的文件
      

  3.   

    问题是,那是个快捷方式 xxx.url,而不是一个应用程序xxx.exe,请问,这个下载输出怎么实现呢?
      

  4.   

    <?php
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=\"url.url\"");
    ?>关键是设置header
      

  5.   

    以下代码可以实现,不过IE的默认安全级别是不允许直接对客户端文件进行操作的,使用前得修改ie安全级别。如果能随便写入硬盘文件,那挂马可就容易了。个人感觉不太实用。以下代码在IE8 win7下测试通过(级别低)
    <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.lzpnb.com/','大智若鲁's blog)">
      

  6.   

    呵呵,没想到你也对这个感兴趣C:\Documents and Settings\***\Favoritesphp把这里面的某个文件输出并强制下载就行了
      

  7.   

    我还发现,右键点击这个 shortcut.php 另存为 居然也可以保存为 桌面快捷方式。我怀疑,这个会不会根本就不是真正的php文件啊?
      

  8.   

    不是吧?就是下载了一个 开心网.url 的文件而已。。
      

  9.   

    那右键点击 另存为 又怎么解释呢?按理说,是应该下载了 shortcut.php 啊。
      

  10.   

    加了个http的头呗。给你看一下全部Http协议全文HTTP/1.1 200 OK
    Date: Thu, 21 Jan 2010 05:31:52 GMT
    Server: Apache
    Content-Encoding: no-gzip
    Content-Disposition: attachment; filename="¿ªÐÄÍø.url"
    Content-Length: 114
    Vary: User-Agent
    Connection: close
    Content-Type: application/octet-stream[InternetShortcut]
    URL=http://www.kaixin001.com/
    IDList=
    [{000214A0-0000-0000-C000-000000000046}]
    Prop3=19,2
      

  11.   


    <?php 
    $file='test.url';
    header("Content-Encoding: no-gzip"); 
    header("Content-Disposition: attachment; filename=\"$file\""); 
    header("Content-Length: 114"); 
    header("Connection: close"); 
    header("Content-Type: application/octet-stream"); 
    echo "[InternetShortcut] 
    URL=http://www.kaixin001.com/ 
    IDList= 
    [{000214A0-0000-0000-C000-000000000046}] 
    Prop3=19,2";
    ?> 
     没有下载过程,没实现...
      

  12.   

    http头和内容之间要用两个回车,你给少掉啦
      

  13.   

    <?php 
    $filename="开心网.url";
    header("Content-Disposition: attachment; filename=".urlencode($filename));
    header("Content-Type: application/octet-stream");
    ?>
    [InternetShortcut]
    URL=http://www.kaixin001.com/
    IDList=
    [{000214A0-0000-0000-C000-000000000046}]
    Prop3=19,2
      

  14.   

    不就是下载了一个internet快捷方式么
      

  15.   

    大家可以看看这篇文章类似WebQQ“设为桌面图标”的ASP及PHP源代码
    http://www.cnarrow.com/post/shorturl.html
      

  16.   


    public function shortcutAction()
    {
    $this->_helper->layout->disableLayout(); 
    $this->_helper->viewRenderer->setNoRender( true );
    $url = site_url();
    $Shortcut = "
    [InternetShortcut] 
    URL=".$url."
    IDList=IconIndex=43
    IconFile=/favicon.ico
    HotKey=1626
    [{000214A0-0000-0000-C000-000000000046}]
    Prop3=19,2";
     Header("Content-type: application/octet-stream");
     header("Content-Disposition: attachment; filename=开心网.url");
    echo $Shortcut; 
    }
      

  17.   

    $Shortcut = "[InternetShortcut]
    URL=http://www.7guo.com
    IDList=
    [{000214A0-0000-0000-C000-000000000046}]
    Prop3=19,2
    ";
    $ua = $_SERVER["HTTP_USER_AGENT"]; $filename = "开心网.url";
    $encoded_filename = urlencode($filename);
    $encoded_filename = str_replace("+", "%20", $encoded_filename);

    header('Content-Type: application/octet-stream');

    if (preg_match("/MSIE/", $ua)) {
     header('Content-Disposition: attachment; filename="' . $encoded_filename . '"');
    } else if (preg_match("/Firefox/", $ua)) {
     header('Content-Disposition: attachment; filename*="utf8\'\'' . $filename . '"');
    } else {
     header('Content-Disposition: attachment; filename="' . $filename . '"');
    }
    echo $Shortcut;