PHP generates a Web page desktop shortcut

Source: Internet
Author: User
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.

  • 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.