我现在的问题是,当单击表中的一个环节,是被触发的模态不显示在PHP代码中给出一个.txt文件。在PHP语句嵌套在HTML <p>
和<pre>
结款,并使用fopen
和fread
方法。该代码一旦执行,只显示一个空框。.txt文件没有显示在引导模式了
<div id=<?php echo "$id"; ?> class="modal fade" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header"><button aria-hidden="true" class="close"data-dismiss="modal" type="button">×</button>
<h4 class="modal-title"><?php echo "$first_name $last_name"; ?></h4>
</div>
<div class="modal-body"><img src="empty_profile.gif" width="200px" height="200px" alt="Pic goes here"><br>
<a href="mail goes here" target="_blank"><i class="fa fa-envelope"></i> Mail</a>
<p>
<pre>
<?php
$file = fopen("358.txt", "r") or die("txt not found!!1");
$read=fread($file);
echo "$read";
fclose($file);?>
</pre>
</p>
</div>
的PHP文件的最佳地点的I/O,在我看来,是“模态体”级DIV中,为模态的格式结构将只允许它是后右头。我如何获取文件内容以显示在我的模式中?
如果你想使用'fread'您需要的文件的长度或块迭代,直到文件的末尾被击中。 – Scuzzy
怎么了这一切'回声“$ somevar”'?你并不需要用引号括变量 – Phil