2
網頁目前,我有這樣的代碼:PHP分割線爲
<?php
if (isset($_GET['id'])) {
$itemid = $_GET['id'];
$search = "$itemid";
$query = ucwords($search);
$string = file_get_contents('http://example.com/tools/newitemdatabase/items.php');
if ($itemid == "") {
echo "Please fill out the form.";
} else {
$string = explode('<br>', $string);
foreach ($string as $row) {
preg_match('/^(.+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
if (preg_match("/$query/i", "$matches[1]")) {
echo "<a href='http://example.com/tools/newitemdatabase/info.php?id=$matches[2]'>";
echo $matches[1];
echo "</a><br>";
}
}
}
} else {
echo "Item does not exist!";
}
?>
我想要做的就是採取一切其結果是在該行echo $matches[1];
和只有5條線的頁面之間拆分它的每頁。
這是什麼是目前發生的事情爲例:
http://clubpenguincheatsnow.com/tools/newitemdatabase/search.php?id=blue
所以我想要做的是分裂的線成單獨的頁面只有五各線。
例如:
http://example.com/tools/newitemdatabase/search.php?id=blue&page=1
http://example.com/tools/newitemdatabase/search.php?id=blue&page=2
- 等
我同意,indent所以它的可讀性被高估了。 – DaveRandom
不要在preg_match中使用'「$ matches [1]」''。是的,它需要一個字符串,但是如果'「匹配[1]」'是一個字符串,那麼它是可以的。 –