PHP致命错误:未定义的类常量“WRITE\u SCOPE”

PHP致命错误:未定义的类常量“WRITE\u SCOPE”,php,google-app-engine,Php,Google App Engine,我在Google appengine中使用PHP应用程序, 我试图读取一个输入文件并将其写入存储桶中的输出文件,如下所示 $input_file = fopen('gs://mybucket/input.csv','r'); $output_file = fopen('gs://mybucket/output.csv', 'w'); 试着写一些日期,比如 while(!feof($input_file)) { $csv = fgetcsv($input_file,1024);

我在Google appengine中使用PHP应用程序, 我试图读取一个输入文件并将其写入存储桶中的输出文件,如下所示

$input_file = fopen('gs://mybucket/input.csv','r');
$output_file = fopen('gs://mybucket/output.csv', 'w');
试着写一些日期,比如

while(!feof($input_file)) {
    $csv = fgetcsv($input_file,1024);
    if(!$csv[0]){ 
        fclose($output_file); //Close the connection when the loop ends
        fclose($input_file);
        exit(0);
    }
    fwrite($output_file, $csv[0]."\r\n");
}
当我尝试将一些数据上传到输入文件中,并且它也成功地写入output.csv时,它工作得非常好。但如果我尝试了5次或6次以上,它就会在appengine日志中抛出一个错误,如下所示。非常感谢您为解决此问题提供的任何帮助

 2015-04-08 21:31:29.006 PHP Fatal error:  Undefined class constant 'WRITE_SCOPE' in /base/data/home/runtimes/php/sdk/google/appengine/ext/cloud_storage_streams/CloudStorageWriteClient.php on line 214
更新: 我想这是因为同时打开了两个文件流, 做了一些工作解决了这个问题

$input_file = fopen('gs://mybucket/input.csv','r');
$array_acc = array();
while(!feof($input_file)) {
    $csv = fgetcsv($input_file, 1024);
    if($csv[0]) array_push($array_acc, $csv[0]);
}
fclose($input_file);   //close the file

$acc_count = count($array_acc);
$output_file  = fopen('gs://tool-synclio/output.csv','w'); // Open the output file now
while($acc_count > 0){
    fwrite($output_file,$array_acc[$acc_count]."\r\n");
    $acc_count --;
}
fclose($output_file);

但是,我仍在等待有人给出更好的解决方案。

变量中有两个美元符号:

 fwrite($output_file, $$csv[0]."\r\n");

很抱歉,在这里粘贴代码时出错。我现在已经更正了你的应用程序的应用程序id是什么?@StuartLangley我的是synclio工具