网站:http://shawn.sc2broadcast.net/test/
代码:
<?php
$homepage = file_get_contents('http://www.macsiam.com/sites.php');
preg_match_all('%\'http://([^./]+).[^.]+\.[a-z]{2,4}\'%i', $homepage, $domains, PREG_PATTERN_ORDER);
// $domains[0] is an array of matched full URLs (http://whatever.wherever.com/page.php)
// $domains[1] is an array of matched subdomains (whatever)
var_dump($domains[1]);
?>
问题:我想知道如何能够单独保存这个数组的每个值?
答案 0 :(得分:0)
foreach ( $domains as $domain ) {
//balah balah
}