텍스트 파일로 출력하는 달력 스크립트가 있습니다. 텍스트 파일을 열고 배열로 읽어 들인 다음 결과를 출력합니다. 텍스트 파일에는 다음이 포함 content_chunked $에서 중복 된 항목이있을 경우청크 배열에서 고유 값 반환
$content = file('DC_PictureCalendar/admin/database/cal2data.txt');
$content_chunked = array_chunk($content, 6);
if (count($content_chunked > 0))
{
echo "<table>";
for ($i=0;$i<count($content_chunked);$i++)
{
echo "<tr>";
echo "<td valign='top'>";
echo "<div style='padding-top:6px;'>";
echo "<a href='schedule.php'>";
echo "<img src='DC_PictureCalendar/admin/database/images/".$content_chunked[$i][3]."' width='80' height='80' border='2'>";
echo "</a>";
echo "</div>";
echo "</td>";
echo "<td valign='top'>";
echo "<div style='padding-left:5px;'>";
echo "<table>";
echo "<tr>";
echo "<td>";
echo "<h2>";
echo "<a href='schedule.php'>";
echo $content_chunked[$i][1];
echo "</a>";
echo "</h2>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo $content_chunked[$i][2];
echo "<a class='green' href='schedule.php'>";
echo "Read more..";
echo "</a>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
문제가있다 [$ i가] [1] (어떤이있다 :
7/9/2013-7/13/2013
Hot Stuff
By Robert More. Yes, folks, it's all platform shoes, leisure suits..
hotstuff.jpg
1,1,0,
*-*
7/16/2013-7/20/2013
Hot Stuff
By Robert More. Yes, folks, it's all platform shoes, leisure suits..
hotstuff.jpg
1,1,0,
*-*
내 PHP 코드는 다음과 같습니다 제목이이 경우), 나는 단지 두 번 대신 한 번 표시하고 싶다. 이것이 가능한가? array_unique가 작동한다고 생각했지만 도움이되지 않았다. 미리 감사드립니다!
- 날짜가 다른 여부에 대한 걱정없이. – dotbill
헤이의 도트볼. 작동하지 않는 것 같습니다. 어떻게 실제로 제목을 출력합니까? – soc
for 루프의 바깥 쪽 - var_dump ($ titles); titles 배열에 무엇이 있는지보기 – dotbill