2012-11-05 3 views

답변

1

단락의 스타일 또는 각 줄의 스타일에 따라 다름 당신의 TXT 파일,

각 라인의 경우에서, 당신은 할 수 있습니다 :

$myfile = 'filetoread.txt'; 
$lines = file($myfile);  
for($i=count($lines);$i>0;$i--){ 
    echo "<span class='yourstyleclass'> $lines[$i] </span>"; 
} 

if paragraphs 

$myfile = 'filetoread.txt'; 
$lines = file($myfile); 

$lines = str_replace(array("\n\n", "\n\r"), "</p><p>", $lines); 
echo "<p>$lines</p>"; 
0

당신이 당신의 "text_file.txt"이 있다고 가정하자 :

<div> 
<h1>Header</h1> 
<p>Some short paragraph...</p> 
</div> 

당신이해야 할 모든은 다음과 같습니다

echo file_get_contents("text_file.txt"); 
관련 문제