我現在的問題是,當單擊表中的一個環節,是被觸發的模態不顯示在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