PHP Create desktop Shortcut implementation method, PHP Create desktop shortcut _php Tutorial

Source: Internet
Author: User
Tags learn php programming

PHP Create desktop Shortcut implementation method, PHP create desktop shortcuts


First case: PHP generates a Web page desktop shortcut

Will introduce the use of PHP to generate Web page desktop shortcut code, and add icons and solve the different browser save garbled problem.

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:

<?php$filename = ' Daybreak 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 * @pa Ram String $icon icon path */function createshortcut ($filename, $url, $icon = ') {//create codebase $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 the user's browser $user _agent = $_server[' http_user_agent ');  $encode _filename = Rawurlencode ($filename); Different browsers use different encodings to 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, clicking on it will automatically open the browser and access the site content.

second case: PHP Implementation of Web site saving shortcut desktop Way


[{000214a0-0000-0000-c000-000000000046}] prop3=19,2 "; Header ("Content-type:application/octet-stream"); header ("Content-disposition:attachment; Filename= ". $title.". URL; "); Echo $Shortcut;? >

The third case: PHP Build site Desktop shortcuts
PHP generated desktop shortcuts is so simple, when you build the time to change the site you want to build.
Dianji.html Code:
Create a shortcut to the left
shengcheng.php Code:

<?php//website Survival Left Shortcut---function $url = $_get[' url '); $filename = UrlDecode ($_get[' name '); $filename = Iconv (' GBk ', ' utf-8 ', $filename);//Character Set conversion (no need to turn without turning) 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 PHP programming.

Articles you may be interested in:

    • Code to create a Web desktop shortcut with PHP or ASP
    • PHP Create instance code for desktop shortcuts
    • PHP Build website Desktop shortcut code share

http://www.bkjia.com/PHPjc/1087282.html www.bkjia.com true http://www.bkjia.com/PHPjc/1087282.html techarticle PHP Create Desktop Shortcut implementation method, PHP Create desktop shortcut first case: PHP generated Web desktop shortcut will introduce the use of PHP to generate the page desktop shortcut code, ...

  • Related Article

    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.