问题描述
我有一个休息URL,我正在尝试使用在线编辑器访问URL。在URL中有查询参数“ ...... / Location_Address?Location%21ID = 92b913cbeafb1000136edb3ea6df1349!6ec4cb72635310000ea06db19466001c” 在查询参数名称中使用“%21”,理想情况下应将%21解码为“!”。但是它将转换为“%2521”。这意味着它用“%25”解码了“%”符号。 我想使查询参数看起来像这样 位置!ID = 92b913cbeafb1000136edb3ea6df1349!6ec4cb72635310000ea06db19466001c“
请帮助?
我对查询参数的大招看起来像这样
$fileData = file_get_contents("https://storage.googleapis.com/xxxx/".$att->ATT_FILE);
$dir = sys_get_temp_dir();
$tmp = tempnam($dir,$fileN);
file_put_contents($tmp,$fileData);
$filetoUpload = new File($tmp);
$filename = $fileN;
$mimeType = mime_content_type($tmp);
$driveService = Storage::cloud();
$client = new \Google_Client();
$client->setClientId('xxxx');
$client->setClientSecret('xxx');
$client->refreshToken('xxx');
$client->setApplicationName('xxx');
$service = new \Google_Service_Drive($client);
// Test 1
$file = new \Google_Service_Drive_DriveFile();
$file->title = $fileN;
$file->name = $fileN;
$file->parents = array($basePath);
$chunkSizeBytes = 1 * 1024 * 1024;
// Call the API with the media upload,defer so it doesn't immediately return.
$client->setDefer(true);
$request = $service->files->create($file);
// Create a media file upload to represent our upload process.
$media = new \Google_Http_MediaFileUpload(
$client,$request,$mimeType,null,true,$chunkSizeBytes
);
$media->setFileSize(filesize($tmp));
// Upload the varIoUs chunks. $status will be false until the process is
// complete.
$status = false;
$handle = fopen($tmp,"rb");
while (!$status && !feof($handle)) {
$chunk = fread($handle,$chunkSizeBytes);
$status = $media->nextChunk($chunk);
}
// The final value of $status will be the data from the API for the object
// that has been uploaded.
$result = false;
if($status != false) {
$result = $status;
}
fclose($handle);
解决方法
替换
"name": "Location%21ID"
使用
"name": "Location!ID"