问题
I am trying to detect Microsoft Edge using hisorange/browser-detect package in my Laravel 5.2 project.
As I understand, I should merely write Browser::isIE() to detect Internet Explorer and Edge, but unfortunately it shows only Internet Explorer.
回答1:
According to the developers you have to check for Microsoft Edge like this:
Browser::isIE(true);
This will include the Trident into the matching.
It was not added originally because the Trident is not a traditional IE update.
In order to detect Microsoft edge yourself just do:
$user_agent = $_SERVER['HTTP_USER_AGENT'];
preg_match('/Edge/i', $user_agent)
来源:https://stackoverflow.com/questions/48096786/detecting-ms-edge-with-hisorange-browser-detect-in-php