2013-10-11 1 views
0
for ($i=0; $i<=$lines; $i++) 
{ 
    //get each line and exlplode it.. 
    $part = explode('|', $file[$i]); 

    //now start printing .. 
    echo'<tr> 

      <td width="20%">'.$part[0].'</td> 

      <td width="20%">'.$part[1].'</td> 

      <td width="20%">'.$part[2].'</td> 

      <td width="20%">'.$part[3].'</td> 

      <td width="20%">'.$part[4].'</td> 

     </tr>'; 
} 

이것은 내 코드이며 텍스트 파일에서 읽었고 테이블에서 폭발하지만, 여기에 약간의 문제가 있습니다. 링크가 필요합니다. HTML 표의 열을 하이퍼 링크로 변경하십시오.

<td width="20%">'.$part[2].'</td> 

.$part[2].

파일에서 단지 단어이지만 내가 파일 코드의 종류하지 않았다

에서 해당

단어를 가질 필요가 끝이 www.somesite.com/?q= 같은 쿼리를 가지고 나를 위해 일 <td width="20%"> <a herf='www.somesite.com/?q=''.$part[2].'> '.$part[2].' </a> </td>

나는 진짜로이 도움이 필요해 ...

<?php 

//first, get the file... 

$file = file('req.txt'); 



//now count the lines .. 

$lines = count($file); 



//start the table here.. 

echo'<table border="2" width="100%">'; 

echo'<tr> 

       <td width="20%">Naslov</td> 

       <td width="20%">Vrsta</td> 

       <td width="20%">IP</td> 

       <td width="20%">Dodano (DD.MM.YY - HH.MM)</td> 

       <td width="20%">Status</td> 
     </tr>'; 


//start the loop to get all lines in the table.. 

for ($i=0; $i<=$lines; $i++) { 



//get each line and exlplode it.. 

    $part = explode('|', $file[$i]); 

//now start printing .. 

    echo'<tr> 

       <td width="20%">'.$part[0].'</td> 

       <td width="20%">'.$part[1].'</td> 

       <td width="20%">'.$part[2].'</td> 

       <td width="20%">'.$part[3].'</td> 

       <td width="20%">'.$part[4].'</td> 
     </tr>'; 

} 



//close the table so HTML wont suffer :P 

echo'</table>'; 




?> 

Final Product

+1
+0

대답을 다시 보아라, 내가 전체 스크립트 & 결과를 게시했다. –

+0

당신의 업데이트는 "어떻게해야합니까? 더 나은 일을 ""내 프로그램을 만들어주십시오 ". 나는 당신의 원래 질문에 대답했다. 내 대답을 사용하여 코드의 해당 부분을 개선 할 수 있어야합니다. – ghoti

관련 문제