Я пытаюсь создать код, который, основываясь на информации от BD, создает архив bibtex. Вот что я получил:создать архив bibtex с PHP
<?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');
?>
После этого он загружает архив с именем «Идентификатор ресурса №6», почему? Название должно быть основано на этом: $name = $_GET['id'] . ".bib"
.
Спасибо!
Понял! Работал как шарм! А о переменной $ text? Почему у него нет результата в архиве и «эхо» @phdthesis {php ....... 'делает? –
См. Мое ** обновление **. –
Вы только что спасли меня. Большое вам спасибо. знать, что вы объяснили. Спасибо, человек :) –