나는 정규식에 익숙하지만 지금은 배울 시간이 없다. eregi ("^ ..? $", $ file)를 preg_match()로 변환해야하지만 나는 ' 그것을하는 방법을 안다면, 아무도 나를 도울 수 있습니까?PHP eregi를 preg_match로 변환하면 어떻게됩니까?
또한 나에게 어떻게 작동하는지 조금 이해를 제공하는 것은 코드 :
조각 가지고 좋은 것 :
$fileCount = 0;
while ($file = readdir($dh) and $fileCount < 5){
if (eregi("^..?$", $file)) {
continue;
}
$open = "./xml/".$file;
$xml = domxml_open_file($open);
//we need to pull out all the things from this file that we will need to
//build our links
$root = $xml->root();
$stat_array = $root->get_elements_by_tagname("status");
$status = extractText($stat_array);
$ab_array = $root->get_elements_by_tagname("abstract");
$abstract = extractText($ab_array);
$h_array = $root->get_elements_by_tagname("headline");
$headline = extractText($h_array);
if ($status != "live"){
continue;
}
echo "<tr valign=top><td>";
echo "<a href=\"showArticle.php?file=".$file . "\">".$headline . "</a><br>";
echo $abstract;
echo "</td></tr>";
$fileCount++;
}
시간을 할애해야 할 수도 있습니다. 어쩌면 우리는 아무 것도 쓸모가 없습니다. – RiggsFolly
스택에 대한 빠른 견해는 같은 질문을 한 다른 사람들을 나타낼 것입니다. 아마도 도움이 될 것입니다. http://stackoverflow.com/questions/2501494/how-to-convert-eregi-to-preg-match? rq = 1 – RamRaider
누군가가 당신을 위해 코드를 작성하기를 기다리는 대신 정규 표현식을 배우는 것이 좋습니다. 아주 간단합니다. – lorond