输出没有括号标记的结果

时间:2012-11-15 19:43:33

标签: php

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

而不是[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>

1 个答案:

答案 0 :(得分:1)

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

foreach ($results as $r) {
    echo "@" . $r . "&";
}