function getDefaultHttp($host){
@exec('REG QUERY HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice',$r1);
$p1='';
foreach ($r1 as $v1){
if(preg_match("/ProgId(.*)/",$v1,$r2)){
$p1 = $r2[0];
break;
}
}
if($p1){
$p1 = str_replace(['ProgId','REG_SZ',' '],'',$p1);
}
@exec("REG QUERY HKEY_CURRENT_USER\Software\Classes\\$p1\\shell\open\command",$r3);
$p2='';
foreach ($r3 as $v3){
if(preg_match("/\(Default\)(.*)\"/",$v3,$r4)){
$p2 = $r4[0];
break;
}
}
if($p2){
$p2 = str_replace(['(Default)','REG_SZ',' ','"'],'',$p2);
}
@exec("start $p2 $host");
}
getDefaultHttp('https://baidu.com')
03-11
688
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-16
1550
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-21
365
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-13