这是一个在Google App Engine上运行的php应用程序。我正在使用getImageServingUrl获取URL并将其存储以备后用。实际上,我已经在应用程序的另一部分中实现了此功能,但是在这种情况下,运行时,php代码会在我进行调用以获取url的位置停止。页面或App Engine日志中没有错误。还有别的地方出错吗?我没有找到问题的运气。这就是我所拥有的:
// At the top of the page I call this
use google\appengine\api\cloud_storage\CloudStorageTools;
// Some processing takes place to get the storage location of the image then
if (is_file($full_path_photo)) {
echo 'Getting URL...<br>';
$object_public_url = CloudStorageTools::getImageServingUrl($full_path_photo, ['secure_url' => true]);
echo 'Successful<br>';
};
// I've also tried it like this:
$object_public_url = CloudStorageTools::getImageServingUrl($full_path_photo);
// And adding this before the call:
CloudStorageTools::deleteImageServingUrl($full_path_photo);
运行此命令时,我得到“正在获取URL ...”,然后什么也没有。该页面只是停止执行。
答案 0 :(得分:0)
Try / Catch能够收到此错误消息。就我而言,这是一个通用错误。对于整个问题,我认为与我的工作量有关。我用不同的桶尝试了整个过程,它似乎可以工作。这是示例-
// At the top of the page I call this
use google\appengine\api\cloud_storage\CloudStorageTools;
// Some processing takes place to get the storage location of the image in GCP storage then
if (is_file($full_path_photo)) {
try {
$object_public_url = CloudStorageTools::getImageServingUrl($full_path_photo, ['secure_url' => true]);
throw new Exception();
} catch (Exception $e) {
echo 'Error: '.$e->getMessage().'<br>';
};
感谢汤姆的帮助。