標籤:style blog http color strong 檔案
要利用php建立案頭捷徑我們需要藉助於header,InternetShortcut及一些我看不懂的代碼。
方法:建立一個php檔案,然後把下面的代碼扔進去,儲存為比如shortcut.php,放在網站跟目錄,代碼如下:
$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;
執行個體:
header("Content-type: text/html; charset=utf-8"); $url = ‘http://php.net/manual/zh/function.get-meta-tags.php‘; $metas = get_meta_tags($url); $kws_arr = array_filter(array_map(‘trim‘, explode(‘,‘,$metas[‘keywords‘]))); $filename = empty($kws_arr)?‘收藏‘:$kws_arr[0]; //print_r($metas); $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;