In the first case: PHP Generate Web Desktop Shortcuts
Will introduce the use of PHP to generate Web desktop shortcuts to the code, and add icons and solve the different browser to save the garbled problem.
When we visit the site, if the content of the site is very attractive, generally we will use the browser's Favorites feature, the collection of this site.
In a browser-favorite Web page, you need to open the browser and select access from Favorites.
If you can go directly to the Web site on your desktop, this can facilitate user access.
We can use PHP to create a Web page shortcut entry file, save to the user desktop, user-friendly quick access.
The generated code is as follows:
<?php $filename = ' Dawn field. URL ';
$url = ' http://fdipzone.com/';
$icon = ' Http://fdipzone.com/favicon.ico ';
CreateShortcut ($filename, $url, $icon); /** * Create file name saved as desktop code * @param string $filename * @param string $url Access connection * @param string $icon icon path * * Functio N CreateShortcut ($filename, $url, $icon = ') {//create basic code $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 user browser $user _agent = $_server[' http_user_agent '];
$encode _filename = Rawurlencode ($filename); Different browsers use different encodings for 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, click to automatically open the browser and access the content of the site.
In the second case: PHP Implementation site save shortcut Desktop Way
<?php
/* Save shortcut.php Access to save the desktop
* * *
$title = "cloud Habitat Community";
$Shortcut = "[Internetshortcut]
url=http://www.jb51.net
[{000214a0-0000-0000-c000-000000000046}]
prop3=19,2 ";
Header ("Content-type:application/octet-stream");
Header ("content-disposition:attachment; Filename= ". $title.". URL; ");
echo $Shortcut;
? >
In the third case: PHP Build Web site Desktop shortcuts
PHP To create a desktop shortcut is so simple, we build when you change the site you want to generate.
dianji.html Code:
<a href= "a.php?url=www.jb51.net&name= cloud-dwelling community" > Generate left Shortcut </a>
shengcheng.php Code:
<?php
//Site survival left shortcut---function
$url = $_get[' url '];
$filename = UrlDecode ($_get[' name '));
$filename = Iconv (' GBk ', ' utf-8 ', $filename);/Character set conversion (no need to turn)
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;
? >
I hope this article will help you learn about PHP programming.