2009-09-26 52 views
-3

任何人都可以幫助我如何使用像indeed.com這樣的php進行尋呼。用像像Indeed.com一樣的php進行尋呼

注: 1.頁面視圖是:1,2,3,4,...... 2.但是開始= 10,開始= 20,...

+2

體面的文章你必須是一個小更多的信息與你的問題。你有什麼問題?你有什麼嘗試? – random 2009-09-26 06:32:23

回答

2

的原理?如下:

$total = 40; // total item count 
$itemsPerPage = 10; 
$pages = ceil($total/$itemsPerPage); 

echo '<ul>'; 
for ($i = 0; $i < $pages; ++$i) { 
    echo '<li><a href="?start=' . ($i * $itemsPerPage) . '">' . ($i + 1) . '</a></li>'; 
} 
echo '</ul>';