<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                本地的圖片果然是通過這個接口進行上傳的。上傳表單的文件`name`為 “file"。接口地址如下: http://image.baidu.com/pcdutu/a_upload?fr=html5&target=pcSearchImage&needJson=true 代碼 ``` <?php /** * 上傳圖片到百度識圖接口,獲取圖片外鏈 * * @param $file 圖片文件 * @return 圖片鏈接(上傳成功) NULL(上傳失敗) * @copyright (c) mengkun(https://mkblog.cn/1619/) */ function uploadToBaidu($file) { // API 接口地址 $url = 'http://image.baidu.com/pcdutu/a_upload?fr=html5&target=pcSearchImage&needJson=true'; // 文件不存在 if(!file_exists($file)) return ''; // POST 文件 if (class_exists('CURLFile')) { // php 5.5 $post['file'] = new CURLFile(realpath($file)); } else { $post['file'] = '@'.realpath($file); } // CURL 模擬提交 $ch = curl_init(); curl_setopt($ch, CURLOPT_URL , $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $output = curl_exec($ch); curl_close($ch); // 返回結果為空(上傳失敗) if($output == '') return ''; // 解析數據 $output = json_decode($output, true); if(isset($output['url']) && $output['url'] != '') { return $output['url']; } return ''; } // 使用示例: $url = uploadToBaidu('1.jpg'); echo $url; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看