PHP Three create desktop shortcuts

Source: Internet
Author: User
This article mainly introduces PHP three to create desktop shortcuts interested in the friend's reference, I hope to help you.

First case: PHP generates a Web page desktop shortcut

The generated code is as follows:

<?php$filename = ' Daybreak field. URL '; $url = ' http://fdipzone.com/'; $icon = ' Http://fdipzone.com/favicon.ico '; CreateShortcut ($filename, $url, $icon);/** * Create Save As Desktop code * @param string $filename saved file name * @param string $url access to the connection * @pa Ram String $icon icon path */function createshortcut ($filename, $url, $icon = ') {//create codebase $shortCut = "[internetshortcut]\  R\nidlist=[{000214a0-0000-0000-c000-000000000046}]\r\nprop3=19,2\r\n "; $shortCut. = "Url=". $url. "  \ r \ n ";  if ($icon) {$shortCut. = "iconfile=". $icon. "";  } header ("Content-type:application/octet-stream");  Get the user's browser $user _agent = $_server[' http_user_agent ');  $encode _filename = Rawurlencode ($filename); Different browsers use different encodings to output if (Preg_match ("/msie/", $user _agent)) {header (' content-disposition:attachment; Filename= '. $encode _filename. ' "');} else if (Preg_match ("/firefox/", $user _agent)) {header ("content-disposition:attachment; Filename*=\ "UTF8" ". $filename. ' ');}  else{header (' content-disposition:attachment; Filename= '. $filename. ');} echo $shortCut;}? >

Download Save to Desktop

Save to Desktop

After the desktop is saved as *.url, clicking on it will automatically open the browser and access the site content.

second case: PHP Implementation of Web site saving shortcut desktop Way

<?php/* Save shortcut.php Access to save Desktop */$title = "Home of the script"; $Shortcut = "[internetshortcut]url=http://www.jb51.netidlist= [{ 000214a0-0000-0000-c000-000000000046}] prop3=19,2 "; Header ("Content-type:application/octet-stream"); header ("Content-disposition:attachment; Filename= ". $title.". URL; "); Echo $Shortcut;? >

The third case: PHP Build site Desktop Shortcuts PHP generated desktop shortcuts is so simple, when you build the time to change the site you want to build.
Dianji.html Code:
<a href= "a.php?url=www.jb51.net&name= script House" > Generate left Shortcut </a>shengcheng.php code:

<?php//website Survival Left Shortcut---function $url = $_get[' url '); $filename = UrlDecode ($_get[' name '); $filename = Iconv (' GBk ', ' utf-8 ', $filename);//Character Set conversion (no need to turn without turning) 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;?>

Summary : The above is the entire content of this article, I hope to be able to help you learn.

Related recommendations:

PHP Two-dimensional array-Rectangle transpose instance sharing

Examples of how PHP can add watermarks to images

PHP encryption and Decryption class example of the detailed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.