【发布时间】:2016-02-24 19:32:20
【问题描述】:
我正在尝试创建一个代码,该代码基于来自 BD 的信息,创建一个 bibtex 存档。这就是我得到的:
<?php
include("classe/conexao.php");
session_start();
$_SESSION[id_tese_especifica] = $_GET['id'];
$result = pg_query("SELECT titulo, id, data, autor_nome FROM teses ORDER BY data DESC");
$arr = pg_fetch_array($result);
echo "@phdthesis{phpthesis,
author={" . $arr[0] . "},
title={" . $arr[6] . " " . $arr[3] . "},
month={" . $arr[2] . "}";
$name = $_GET['id'] . ".bib";
$file = fopen($name, 'a');
$text = "test (it doesn't appears on archive and I don't know why, so I used the echo above and worked, but this is what should be on archive, or isn't?)";
fwrite($file, $text);
readfile($file);
fclose($fp);
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Expires: 0');
?>
之后,它会下载一个名为“Resource id #6”的存档,为什么?名称应以此为依据:$name = $_GET['id'] . ".bib"。
谢谢!
【问题讨论】:
标签: php postgresql bibtex