PHP Creates Desktop shortcuts and php shortcuts
To create a desktop shortcut using php, we need to use header, InternetShortcut, and some code that I don't understand.
Method:Create a new php file, and then throw the following code into the directory, such as shortcut. php, and put it in the website and directory. The Code is as follows:
$shortCut = "[InternetShortcut] URL=http://www.baidu.com IDList= [{000214A0-0000-0000-C000-000000000046}] Prop3=19,2 "; Header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=baidu.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>
How does javascript create a desktop shortcut?
Common online calls
WshShell. CreateShortcut, but only Internet Explorer supports ActiveXObject objects.
Therefore, to achieve this, you can only run the backend and return a shortcut.
Similar to downloading files
I found a php example for you.
<? Php $ Shortcut = "[InternetShortcut] URL = xxxxIconFile = xxx. ico IconIndex = 0 HotKey = 1613 IDList = [{000214A0-0000-0000-C000-000000000046}] Prop3 = 19,2 "; header (" Content-Type: application/octet-stream "); header ("Content-Disposition: attachment; filename = xxxx. url "); echo $ Shortcut;?>