【发布时间】:2013-10-05 02:28:49
【问题描述】:
我在托管在 Google App Engine 上的应用程序中使用了 glob() 函数,而我的 text_files 在 Google Cloud Storage 上。它不起作用并返回false。 代码如下:
$links = glob("gs://bucket_name/folder/textfile_*");
if($links){
echo "true \n";
print_r($links);
}else{
echo "false";
}
而我在 GCS 上的文件是这样的:
textfile_Ben.txt
textfile_Sam.txt
textfile_David.txt
我查看了http://php.net/manual/en/function.glob.php,上面写着:
注意:此功能对远程文件不起作用 检查的必须可以通过服务器的文件系统访问。
我的应用程序可以与file_get_contents() 或file_put_contents() 等其他功能一起正常工作。
问题:
有没有使用glob() 函数的解决方案,或者有没有其他方法可以实现相同的功能?
【问题讨论】:
-
glob 不能使用 url,只能使用文件系统路径。这个答案可能会帮助stackoverflow.com/questions/6997887/…
标签: php google-app-engine