我想添加一个$ var [5],它包含字符串值到以下url的{subscription_reference}部分.
$url5 = $api_entry_point ."/subscription/{subscription_reference}/credentials";
Run Code Online (Sandbox Code Playgroud)
它需要像这样..
$url5 = $api_entry_point ."/subscription/0997f4ea6b6ca709/credentials";
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的方法,但都出了问题.那些都是
$url5 = $api_entry_point ."/subscription/'.$var[5].'/credentials";
$url5 = $api_entry_point ."/subscription/$var[5]/credentials";
Run Code Online (Sandbox Code Playgroud) 我正在尝试将一些图像压缩为用户选择的。到目前为止,我已经提出了一个压缩解决方案。我的问题是在我将相关数据压缩到 zip 文件后如何通过浏览器下载它。我尝试了不同的方法仍然不起作用。当我创建 zip 时,它存储在公共文件夹中。如何通过浏览器从那里下载 zip 文件?
这是我的代码
$photos = json_decode(Input::get('photos'));
$dir = time();
foreach ($photos as $file) {
/* Log::error(ImageHandler::getUploadPath(false, $file));*/
$imgName = last(explode('/', $file));
$path = public_path('downloads/' . $dir);
if (!File::exists($path)) {
File::makeDirectory($path, 0775, true);
}
ImageHandler::downloadFile($file, $path . '/' . $imgName);
}
$rootPath = realpath($path);
$zip_file = 'Photos.zip';
$public_dir = public_path();
$zip = new ZipArchive();
$zip->open($zip_file, ZipArchive::CREATE | ZipArchive::OVERWRITE);
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($rootPath),
RecursiveIteratorIterator::LEAVES_ONLY
);
foreach ($files as $name => …Run Code Online (Sandbox Code Playgroud)