This article will introduce the use of PHP to generate a Web page desktop shortcut code, and add icons and solve different browser save garbled problems.
When we visit the site, if the content of the site is very attractive, generally we will use the browser's favorite features, the collection of this site.
In a browser favorite Web page, you need to open the browser and select access from the Favorites folder.
If you can go directly to the site on the desktop, this can be convenient for user access.
We can use PHP to create a shortcut entry file for the page, save to the user's desktop, convenient for users to quickly access.
The generated code is as follows:
$filename=' Dawn 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 * @param /c13> String $icon Icon path * / functioncreateshortcut($filename, $url, $icon=") {//Create code base$shortCut="[internetshortcut]\r\nidlist=[{000214a0-0000-0000-c000-000000000046}]\r\nprop3=19,2\r\n];$shortCut.="Url=".$url."\ r \ n";if($icon){$shortCut.="Ic> $icon.""; } header ("Content-type:application/octet-stream");//Get user browser$user _agent=$_server[' Http_user_agent '];$encode _filename= Rawurlencode ($filename);//Different browsers use different coded outputsif(Preg_match ("/msie/",$user _agent) {Header (' content-disposition:attachment; filename= '.$encode _filename.'"'); }Elseif(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.
The dawn of the field. url file contents are as follows:
[InternetShortcut]IDList=[{000214A0-0000-0000-C000-000000000046}]Prop3=19,2URL=http://fdipzone.com/Ic>http://fdipzone.com/favicon.ico
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the PHP generated Web page desktop shortcut, including the content of the contents, I hope that the PHP tutorial interested in a friend to help.