使用 GoogleCloudStorage 适配器设置 KnpGaufretteBundle 后,我可以在 Google Cloud Storage 中写入文件。
但我不知道如何检索该文件的公共访问链接(在这种情况下为图像)。
这是我用来编写的代码示例,如果它无论如何都相关的话。其实我必须版本:
$fs = $this->get("knp_gaufrette.filesystem_map")->get("bucket_name");
$fs->write("image.jpg",file_get_contents("/path/to/file"));
或者
$file = new \Gaufrette\File("image.jpg",$this->get("knp_gaufrette.filesystem_map")->get("bucket_name"));
$file->setContent(file_get_contents("/path/to/file"));
关于如何从这里检索公共(“http://..”)网址的任何想法?
谢谢!