我认为当我回显 $whereArray 和 orderByArray 时会出现问题。如果我输入诸如“问题”之类的单词然后提交,我希望它会显示在 echos "%".Question."%"; 对于两个数组。但相反,在两个回声中,它只为两个回声显示“阵列”。这是否意味着在存储值时两个数组都不起作用?
$searchquestion = $_GET['questioncontent'];
$terms = explode(" ", $searchquestion);
$whereArray = array();
$orderByArray = array();
//loop through each term
foreach ($terms as $each) {
$i++;
$whereArray[] = "%".$each."%";
$orderByArray[] = "%".$each."%";
}
echo $whereArray;
echo $orderByArray;