0

如何在替换繁琐的括号标签时输出结果?

而不是 [3] => 56531631380

我想要@56531631380& 用于所有项目

<?php
$f = fopen ('http://fanpagelist.com/category/top_users/view/list/sort/fans/page1', 'r');
$page = '';
while ($line = fgets($f)) {
  $page .= $line;
}
fclose ($f);
preg_match_all('#(?:(?<=\bhref="/like_box\.php\?id=)|' .
                '(?<=\bsrc="https://graph\.facebook\.com/))\d+#i',
                $page, $result, PREG_PATTERN_ORDER);

print_r ($result);

?>


 <pre>
    <?php

echo preg_replace("/\([^)]+\)/","",$result);


    ?>
    </pre>
4

1 回答 1

1

使用 foreach 循环遍历数组 $results:

foreach ($results as $r) {
    echo "@" . $r . "&";
}
于 2012-11-15T20:11:07.813 回答