Home > Article > Backend Development > PHP generates website desktop shortcut code sharing, php shortcut_PHP tutorial
It is so simple to generate desktop shortcuts with PHP. When you generate it, just change the website you want to generate.
dianji.html code:
shengcheng.php code:
//Shortcut on the left side of website survival---function
$url = $_GET['url'];
$filename = urldecode($_GET['name']);
$filename = iconv('GBk','utf-8',$filename);//Character set conversion (if there is no need to convert, it will not be converted)
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;
?>
You have to write a separate page to create the shortcut. I estimate that you have already output the content on the page before, so I am making a mistake
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;
Make a hyperlink when generating
shortcut
is a piece of js code, search JS on Baidu to create a desktop URL shortcut
html code