目前我有这个代码:
<?php
if (isset($_GET['id'])) {
$itemid = $_GET['id'];
$search = "$itemid";
$query = ucwords($search);
$string = file_get_contents('http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php');
if($itemid=="")
{
echo "Please fill out the form.";
}
else
{
$string = explode('<br>',$string);
foreach($string as $row)
{
preg_match('/^(\D+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
if(strstr($matches[1], $query))
{
echo "<a href='http://clubpenguincheatsnow.com/tools/newitemdatabase/info.php?id=$matches[2]'>";
echo $matches[1];
echo "</a><br>";
}
}
if($matches[1]=="")
{
echo "Item does not exist!";
}
}
}
else {
echo "Item does not exist!";
}
?>
我想知道的是这个部分是什么意思?preg_match('/^(\D+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/', trim($row), $matches);
主要/^(\D+)\s=\s(\d+)\s=\s(\D+)\s=\s(\d+)/
是我想知道的部分。
另外,我一直遇到的一个问题是我怎样才能让它也使用数字?因为我有另一个包含数据的文件 (http://clubpenguincheatsnow.com/tools/newitemdatabase/items.php) 并且它希望它获取所有内容,甚至是带有数字的名称。
我该怎么做呢?请帮我!任何帮助将不胜感激!