首页 > 解决方案 > 我们如何根据 ID 号创建临时页面并检索该 ID 号数据?

问题描述

我目前有一个包含人员数据的表格“candidatedetails”。如果我手动创建页面,我可以检索数据并在页面中显示。但是我不想手动创建每个页面。

我有每个人的链接:

echo '<td> <a href="'.$row['payroll_number'].'"><img src="images/document.jpg" height="30" > </a></td>';

这链接到作为 192.168.1.16/5100 的唯一 ID (payroll_number)(其中 5100 是本例中的工资单号)

我正在尝试使用以下内容,以便当单击上面的链接时,它会创建一个临时文件并转到一个 tmp 页面,在该页面中可以查看所有候选人的详细信息

`<?php
$temp = tmpfile();

fwrite($temp, file_get_contents("$path/$filename"));
//Rewind to the start of file
rewind($temp);
//Read 1k from file
echo fread($temp,1024);

//This removes the file
fclose($temp);
?>`

带有记录链接的人员表的屏幕截图

标签: phpfwritetemporary-files

解决方案


推荐阅读