共有三个数组的形式:
Array (
[0] => NAME
[1] => NAME
[n] => n
)
Array (
[0] => DATE
[1] => DATE
[n] => n
)
Array (
[0] => TEXT
[1] => TEXT
[n] => n
)
尽可能将这三个阵列组合成下一个物种之一?
Array(
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
Array (
[0] => NAME
[1] => DATE
[2] => TEXT
)
and etc.
)
使用库PHP Simple HTML DOM Parser Manual 构建数组
// Search for the name
$array_nameNews = array();
foreach($html->find('div.narrow_column div h2 a') as $element) {
$nameNews = $element->innertext;
$array_nameNews[] = $nameNews;
}
// Search the date
$array_dateNews = array();
foreach($html->find('div.narrow_column div div.postdate') as $element) {
$dateNews = $element->innertext;
$array_dateNews[] = $dateNews;
}
// Search text
$array_textNews = array();
foreach($html->find('div.narrow_column div div.postdate span') as $element) {
$textNews = $element->innertext;
$array_textNews[] = $textNews;
}