我不明白,这条线应该可以正常工作,但事实并非如此。出于某种原因,我无法理解为什么?任何人都可以看到我所缺少的东西。
$code = $_GET["code"];
$file = $_SERVER['DOCUMENT_ROOT'] . '/code/' . $code . '.html'; // set your path from document root.
if (file_exists($file)) {
header("Content-Type: text/html");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
exit;
}
答案 0 :(得分:3)
您的案例中的正确SQL查询是:
SELECT id,client_name FROM clients WHERE id IN ($result)
,因为SQL IN
语法如下:
SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);
答案 1 :(得分:2)
试试这段代码:
$resclients=$mysqli->query("SELECT id,client_name FROM clients WHERE id IN ($result)");