Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php cURL错误35:连接到oauth2.googleapis.com的未知SSL协议错误:443_Php - Fatal编程技术网

Php cURL错误35:连接到oauth2.googleapis.com的未知SSL协议错误:443

Php cURL错误35:连接到oauth2.googleapis.com的未知SSL协议错误:443,php,Php,将文件从服务器推送到google云存储时出错 错误如下所示 cURL错误35:连接到oauth2.googleapis.com:443的未知SSL协议错误(请参阅 请帮我解决这个问题 下面是我的代码 require 'vendor/autoload.php'; use Google\Cloud\Storage\StorageClient; $storage = new StorageClient([ 'keyFilePath' => 'facebooth_bucket.json']);

将文件从服务器推送到google云存储时出错

错误如下所示

cURL错误35:连接到oauth2.googleapis.com:443的未知SSL协议错误(请参阅

请帮我解决这个问题

下面是我的代码

require 'vendor/autoload.php';
use Google\Cloud\Storage\StorageClient;

 $storage = new StorageClient([ 'keyFilePath' => 'facebooth_bucket.json']);
 $bucketName = 'fb-uploads';

$uploadDocument = isset($_FILES['uploaded_file']) ? $_FILES['uploaded_file'] : '';

$uploaddir = "uploads/";

if (isset($uploadDocument['name']) && !empty($uploadDocument['name'])) {

                $uploadFileName = str_replace(" ","_",basename($uploadDocument['name']));

                $ext = pathinfo($uploadFileName, PATHINFO_EXTENSION);
                $fileName = str_replace("." . $ext, "", $uploadFileName);


                $uploadFileName = $fileName . "_" . date('his') . '.' . $ext;

                $uploadfile = $uploaddir . $uploadFileName;
                // die($uploadfile);

                if (move_uploaded_file($uploadDocument['tmp_name'], $uploadfile)) {

                    if(file_exists($uploadfile)) {
                        try {
                                $objectName = $uploadFileName;

                                $file = fopen($uploadfile, 'r');
                                $bucket = $storage->bucket($bucketName);
                                $object = $bucket->upload($uploadfile, [
                                    'name' => $objectName
                                ]);
                                printf('Uploaded %s to gs://%s/%s' . PHP_EOL, basename($uploadFileName), $bucketName, $objectName);
                            // require_once __DIR__ . "/google_storage/vendor/autoload.php";
                            // $storage = new StorageClient([
                            //     'keyFilePath' => '/var/www/html/crewbies/upload_testing/google_storage/key/facebooth_bucket.json'
                            // ]);
                            // $bucket =  $storage->bucket('fb-uploads');
                            // $bucket->upload(
                            //     fopen('/china/$uploadfile', 'r')
                            // );
                        }
                        catch(Exception $e) {
                            $err = $e->getMessage();
                            print_r($err);
                            die('heee');
                        }

                    }

                }


            }

            ?>

您好!您能告诉我们您是如何做到这一点的吗?也许发布一段代码会有所帮助:)我添加了我的code@GuilhermeAssemany您知道从上面的代码将文件上载到bucket中的子文件夹吗?