<span id="pfnzv"></span>
      <form id="pfnzv"><span id="pfnzv"></span></form><address id="pfnzv"><span id="pfnzv"><nobr id="pfnzv"></nobr></span></address>
      <form id="pfnzv"><dfn id="pfnzv"><listing id="pfnzv"></listing></dfn></form>

        <sub id="pfnzv"><address id="pfnzv"></address></sub>
          <address id="pfnzv"><form id="pfnzv"><listing id="pfnzv"></listing></form></address>
          <address id="pfnzv"><address id="pfnzv"><nobr id="pfnzv"></nobr></address></address>

            <address id="pfnzv"></address>
            0712-2888027 189-8648-0214
            微信公眾號

            孝感風信網絡科技有限公司微信公眾號

            當前位置:主頁 > 技術支持 > PHP > Laravel擴展包jenssegers/agent 輕松識別客戶端信息

            Laravel擴展包jenssegers/agent 輕松識別客戶端信息

            時間:2024-08-25來源:風信官網 點擊: 2932次
            Laravel User Agent 輕松識別客戶端信息 —— jenssegers/agent,客戶端會通過這個請求向訪問網站提供瀏覽器類型、操作系統及版本,瀏覽器渲染引擎,瀏覽器語言等標識的信息。
             
            項目地址:https://github.com/jenssegers/agent
             
            安裝命令:
             
            composer require jenssegers/agent
             
            安裝成功之后我們使用tinker進行測試一下。
             
            php artisan tinker
             
            1、實例化一下Agent對象
             
            use Jenssegers\Agent\Agent;
             
            $agent = new Agent();
             
            2、設置相關的頭信息
             
            $agent->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2');
             
            測試信息完整的代碼:
             
            $ php artisan tinker
            Psy Shell v0.9.9 (PHP 7.2.1 — cli) by Justin Hileman
             
            >>> use Jenssegers\Agent\Agent;
            >>>
            >>> $agent = new Agent();
            => Jenssegers\Agent\Agent {#2947}
            >>> $agent->setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2');
            => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2"
            >>> $agent->is('OS X');
            => true
            >>> $agent->isSafari();
            => true
            >>> $agent->browser();
            => "Safari"
            >>> $browser = $agent->browser();
            => "Safari"
            >>> $version = $agent->version($browser);
            => "5.1.7"
            欄目列表
            推薦內容
            熱點內容
            展開
            国产精久久久久无码AV动漫|最新亚洲精品国偷自产在线|2021亚洲色中文字幕在线|最新无码av中文字专区 情欲美妇紧致敏感 国产免费AⅤ片在线播放 人妻爽爽免费在线视频 51精品国产人成在线观看 色偷偷av一区二区三区
            <span id="pfnzv"></span>
                <form id="pfnzv"><span id="pfnzv"></span></form><address id="pfnzv"><span id="pfnzv"><nobr id="pfnzv"></nobr></span></address>
                <form id="pfnzv"><dfn id="pfnzv"><listing id="pfnzv"></listing></dfn></form>

                  <sub id="pfnzv"><address id="pfnzv"></address></sub>
                    <address id="pfnzv"><form id="pfnzv"><listing id="pfnzv"></listing></form></address>
                    <address id="pfnzv"><address id="pfnzv"><nobr id="pfnzv"></nobr></address></address>

                      <address id="pfnzv"></address>