Php generate Web Desktop shortcuts and php generate shortcuts

Source: Internet
Author: User

Php generate Web Desktop shortcuts and php generate shortcuts

This article describes how to use PHP to generate a web desktop shortcut code, add icons, and solve the garbled code problem in different browsers.

When we visit a website, if the content of the website is very attractive, we usually use the favorites function of the browser to add this website to favorites.

To add a webpage to the favorites folder in a browser, open the browser and select it from the favorites folder.

If you can directly access the website on the desktop, this will facilitate user access.

You can use php to create a shortcut file for a webpage and save it to your desktop for quick access.

The generated code is as follows:

<? Php $ filename = 'dawn domain. url '; $ url = 'HTTP: // fdipzone.com/'{}icon = 'HTTP: // fdipzone.com/favicon.ico'{createshortcut ($ filename, $ url, icon $ ); /*** create and save the file name as the desktop Code * @ param String $ filename the saved file name * @ param String $ url access connection * @ param String $ icon path */function createShortCut ($ filename, $ url, $ icon = '') {// create the basic code $ shortCut =" [InternetShortcut] \ r \ nIDList = [{000214a0-0000-0000-c000-00000046}] \ r \ nProp3 = 19,2 \ R \ n "; $ shortCut cut. = "URL = ". $ url. "\ r \ n"; if ($ icon) {$ shortCut cut. = "IconFile = ". $ icon. "";} header ("content-type: application/octet-stream"); // obtain the user's browser $ user_agent =$ _ SERVER ['HTTP _ USER_AGENT ']; $ encode_filename = rawurlencode ($ filename); // different browsers use different encoding to output if (preg_match ("/MSIE/", $ user_agent) {header ('content-disposition: attachment; filename = "'. $ encode_filename. '"');} else if (preg_match ("/Firefox/", $ u Ser_agent) {header ("content-disposition: attachment; filename * = \" utf8 ''". $ filename. '"');} else {header ('content-disposition: attachment; filename = "'. $ filename. '"');} echo $ shortCut;}?>

Download and save to desktop

Save to desktop

After saving it as *. url on the desktop, click it to automatically open the browser and access the website content.

The content of the. url file is as follows:

[InternetShortcut]IDList=[{000214A0-0000-0000-C000-000000000046}]Prop3=19,2URL=http://fdipzone.com/IconFile=http://fdipzone.com/favicon.ico

The above is all the content of this article. I hope this article will help you in your study or work. I also hope to provide more support to the customer's home!

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.