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