国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

上傳圖片開啟本地ssl證書bug問題

bug描述

第一個報(bào)錯,當(dāng)我正確配置證書了,就出現(xiàn)第二個報(bào)錯了
cURL error 60: SSL certificate problem: self signed certificate in certifica 【已解決】

第二個報(bào)錯
ErrorException: Array to string conversion in C:\draw_webman\webman\vendor\workerman\workerman\Protocols\Http.php:209
Stack trace:【未解決】

0 C:\draw_webman\webman\vendor\workerman\workerman\Protocols\Http.php(209): support\App::{closure}(8, 'Array to string...', 'C:\draw_webman\...', 209, Array)

程序代碼或配置

證書配置檢查多次確信無誤

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="D:/phpstudy_pro/Extensions/php/php7.4.3nts/extras/ssl/cacert.pem"

[openssl]
; The location of a Certificate Authority (CA) file on the local filesystem
; to use when verifying the identity of SSL/TLS peers. Most users should
; not specify a value for this directive as PHP will attempt to use the
; OS-managed cert stores in its absence. If specified, this value may still
; be overridden on a per-stream basis via the "cafile" SSL stream context
; option.
openssl.cafile="D:/phpstudy_pro/Extensions/php/php7.4.3nts/extras/ssl/cacert.pem"

期待的結(jié)果及實(shí)際結(jié)果

框架報(bào)錯行數(shù)

截圖

系統(tǒng)環(huán)境及workerman/webman等具體版本

這里寫具體的系統(tǒng)環(huán)境相關(guān)信息
截圖

備注:自己已檢測業(yè)務(wù)代碼,不應(yīng)該是業(yè)務(wù)代碼錯誤,業(yè)務(wù)代碼是從原生tp5復(fù)制過來的

//上傳圖片
    public function upload(Request $request)
    {
        $file = $request->file('file');
        if ($file && $file->isValid()) {
            $info =  $file->move(public_path().'/files/myfile.'.$file->getUploadExtension());
            $fi = './public/files/myfile.'.$file->getUploadExtension();

        $savePath =  time().mt_rand(100000,999999).'.png'; 
        //將圖片傳到騰訊云
        $local_path  = $fi;//文件上傳臨時目錄
        //摳圖完成上傳騰訊云,加快下載速度
        $server_key_name = '/photo/'.date("Ymd",time()).'/'.date("YmdHis",time()).$savePath;//遠(yuǎn)程服務(wù)器存儲的名字
        require './vendor/autoload.php';

        $secretId = "XXX"; //"云 API 密鑰 SecretId";
        $secretKey = "XXX"; //"云 API 密鑰 SecretKey";改成自己的
        $region = "ap-nanjing"; //設(shè)置一個默認(rèn)的存儲桶地域
        $cosClient = new \Qcloud\Cos\Client(
            array(
                'region' => $region,
                'schema' => 'https', //協(xié)議頭部,默認(rèn)為http
                'credentials'=> array(
                    'secretId'  => $secretId ,
                    'secretKey' => $secretKey)
            )
        );

        //定義數(shù)據(jù)
        $upload_success = false;
        $img_url = '';
        $upload_msg = '';

        try {
            $result = $cosClient->upload(
                $bucket = 'xxx-123', //請創(chuàng)建桶的時候 設(shè)置公共讀寫  改成自己的
                $key = $server_key_name,
                $body = fopen($local_path, 'rb')
            );
            // 請求成功,返回透明前景
            $data = $result->toArray() ;
            return $data;
            if(isset($data['Location']) && isset($data['Key'])){
                $img_url = 'https://'.$data['Location'];
                $upload_success = true;
            }
        } catch (\Exception $e) {
            // 請求失敗
            $upload_msg = $e->getMessage();
            return $upload_msg;
        }
        //合成成功
        $data = ['img_url'=>$img_url];
        return $data;
    }
    }
1212 2 0
2個回答

PHP甩JAVA一條街

上傳圖片的業(yè)務(wù)代碼,在我原生tp5里面執(zhí)行正常,復(fù)制到webman,報(bào)框架錯誤,框架錯誤讓我無從下手,有人遇到此類情況嗎?

  • 暫無評論
抽不完的寂寞

關(guān)鍵字 Array to string... ,數(shù)組不能轉(zhuǎn)換為字符串??刂破骼飏eturn array應(yīng)該是錯誤用法,改成 return json($data); 試下

  • PHP甩JAVA一條街 2023-01-04

    謝謝大佬點(diǎn)拔, 果然是的,報(bào)框架錯誤,我沒法定位哪里的問題,按道理應(yīng)該報(bào)我代碼錯誤,不過,非常感謝大佬

年代過于久遠(yuǎn),無法發(fā)表回答
??