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!