我将一个文本区域发布到我的 php 脚本中,然后我对文本区域的每一行执行一个循环,然后再次使用来自文本区域循环的数据。然后我尝试为每个数组设置一个数组,最后为所有数组检索一个数组。但是我的代码给了我错误:
if (isset($_POST['submit'])) {
$entries = array();
$text = trim($_POST['facebookpage']);
$text = explode("\n", $text);
foreach ($text as $line) {
$data = $html2->find("table.profileInfoTable");
$text2 = trim($data[0]);
$text2 = explode("<tr>", $text2);
foreach ($text2 as $line) {
if (strpos($line, 'Location') !== false) {
$location = $line;
}
}
$data1 = $html2->find("table.profileInfoTable");
$text2 = trim($data1[0]);
$text2 = explode("<tr>", $text2);
foreach ($text2 as $line) {
if (strpos($line, 'Email') !== false) {
$email = $line;
}
}
$mainarray = array("Email" => $email, "Location" => $location);
array_push(($mainarray),$entries);
}
var_dump($entries);
}`
错误也是:
Fatal error: Only variables can be passed by reference in /home2/statonme/public_html/scraper.php on line 61