PHP generates website Desktop shortcuts for code sharing and php shortcuts

Source: Internet
Author: User

PHP generates website Desktop shortcuts for code sharing and php shortcuts

The PHP desktop shortcut is so simple that you can change the website you want to generate when you generate it.

Dianji.html code:

Copy codeThe Code is as follows:
<A href = "a. php? Url = www.jb51.net & name = "> Generate a left-side shortcut </a>

Shengcheng. php code:

Copy codeThe Code is as follows:
<? Php

// The left-side shortcut for website survival --- Function

$ Url = $ _ GET ['url'];

$ Filename = urldecode ($ _ GET ['name']);

$ Filename = iconv ('gbk', 'utf-8', $ filename); // Character Set conversion (no conversion is required)

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;

?>


Use PHP to write a download page to the desktop shortcut code. After the website is opened, the following question is displayed. How can this problem be solved?

You need to write a separate page to create a shortcut. I guess you have output content on the page before that, so you have an error

A. php
----------------------------------
$ Url = $ _ GET ['url'];
$ Filename = urldecode ($ _ GET ['name']);
$ Filename = iconv ('utf-8', 'gbk', $ filename); // Character Set Conversion
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;

Create a hyperlink when generating
<A href = "a. php? Url = webpage address & name = shortcut name "> shortcut </a>

Code for creating a desktop shortcut for a website

Is a piece of js Code. Baidu search JS creates a desktop url shortcut

Html code

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "www.w3.org/..al.dtd">
<Html xmlns = "www.w3.org/5o/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
</Head>

<Body>
<Script language = "JavaScript">
Function toDesktop (sUrl, sName ){
Try
{
Var WshShell = new ActiveXObject ("WScript. Shell ");
Var oUrlLink = WshShell. CreateShortcut (WshShell. SpecialFolders ("Desktop") + "\" + sName + ". url ");
OUrlLink. TargetPath = sUrl;
OUrlLink. Save ();
}
Catch (e)
{
Alert ("the current IE security level does not allow operations! ");
}
}
</Script>
<Input name = "btn" type = "button" id = "btn" value = "Create a Netease shortcut to the desktop" onClick = "toDesktop ('HTTP: \ // www.163.com/', 'net ') ">
</Body>
</Html>

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.