그래서 내가 로컬 호스트 웹 사이트에 글꼴을하고있어, 나는 사용자가 카트에 여러 개의 파일을 선택할 수 있도록 관리, 그들은 같은 폴더에서 예를 들어 C를 다운로드 할 수 있습니다 :/fonts/a 또는 C :/fonts/b하지만 a와 b의 파일이있는 경우 다운로드 할 수 없습니다.PHP는 우편 번호 및 여러 폴더에서 파일을 다운로드
이렇게 할 수 있습니까? A와 B 모두에서 다운로드 선택한 파일처럼
다음는
<?php
include 'dbfunctions.php';
if (!$link) {
die(mysqli_error($link));
}
$sql="SELECT id, Font_Name, Font_Family
FROM font";
$result = mysqli_query($link, $sql) or die(mysqli_error($link));
while($row = mysqli_fetch_array($result)){
$Font_Family = $row['Font_Family'];
$a = file_get_contents('./a.txt');
$file_dir = file_get_contents('./font_path.ini');
$path = $file_dir.$Font_Family.$a;
$error = ""; //error holder
if(isset($_POST['createpdf']))
{
$Font_Family = $_POST['Font_Family'];
}
$file_folder = $path;// folder to load files
if(extension_loaded('zip'))
{
// Checking ZIP extension is available
if(isset($_POST['files']) and count($_POST['files']) > 0)
{
// Checking files are selected
$zip = new ZipArchive(); // Load zip library
$zip_name = time().".zip"; // Zip name
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE)
{
// Opening zip file to load files
$error .= "* Sorry ZIP creation failed at this time";
}
foreach($_POST['files'] as $file)
{
$zip->addFile($file_folder.$file,pathinfo($file,PATHINFO_BASENAME));
readfile($path);
}
$zip->close();
if(file_exists($zip_name))
{
// push to download the zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="'.$zip_name.'"');
readfile($zip_name);
// remove zip file is exists in temp path
unlink($zip_name);
}
}
else
$error .= "* Please select file to zip ";
}
else
$error .= "* You dont have ZIP extension";
}
?>
fontpath.ini가 c download.php 내 코드입니다 : \ 글꼴
\ A는 그냥 \ PHP는 나에게 문제가 때를 제공하기 때문에
그래서 경로는 C처럼 \ \ 글꼴 : 그냥 \
FONT_FAMILY은 C 안에 다른 폴더 이름 쓰기에 관계없이 디렉토리의,
PHP는 무슨 문제를 줬어? – DevZer0
그들은 단지 '로 취급하고 그것을 닫습니다. – Ren