-2
給你好,我需要helpt與我的項目,警告:爆炸()預計參數2爲字符串數組中
我需要把刺在表爆炸(),但它不工作。我得到以下錯誤:警告:explode()期望參數2是字符串,數組中給出。我搜索stackoverflow但我無法弄清楚什麼是錯的。
<html>
<head>
<meta charset=utf-8 />
<title>Contact Formulier</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="../vendor/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="../dist/css/bootstrapValidator.css"/>
<!-- Vendor Script -->
<script type="text/javascript" src="../vendor/jquery/jquery-1.10.2.min.js"></script>
<!-- Bootstrap Script -->
<script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../dist/js/bootstrapValidator.js"></script>
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet-src.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://unpkg.com/[email protected]"></script>
</head>
<body>
<div class="container">
<div class="row">
<form id="defaultForm" action="searchtest.php" method="GET"/>
<div class="col-md-6">
<h2>Zoek naar een klacht</h2>
<div id="custom-search-input">
<div class="input-group col-md-12">
<input type="text" name="searchbar" class="form-control input-lg" placeholder="Zoeken..."/>
<span class="input-group-btn">
<button class="btn btn-info btn-lg" type="submit">
<i class="glyphicon glyphicon-search"></i>
</button>
</span>
</div>
</div>
</div>
</div>
</div>
</form>
<div class="col-lg-10">
<table class="table table-bordered">
<tr>
<th>Voornaam</th>
<th>Achternaam</th>
<th>Telefoonnummer</th>
<th>E-mail</th>
<th>Straat</th>
<th>Omschrijving plaats</th>
<th>Onderwerp klacht</th>
<th>Omschrijving klacht</th>
<th>Eventuele omschrijving klacht</th>
</tr>
</div>
</body>
</html>
<?php
//searching in database
$search = '.*'.$_GET['searchbar'].' .*';
$regexObj = new MongoDB\BSON\Regex($search,'i');
$where = array("straat" => $regexObj);
$cursor = $collection->find($where);
$cursor->setTypeMap(['root' => 'array']);
foreach ($cursor as $doc){
echo '<tr>';
$tables[] = explode(",", $doc);
foreach ($tables as $table) {
echo "<td>" . $table . "</td>";
}
echo "</tr>";
}
}
?>
你問一個PHP錯誤,並顯示一個HTML頁面? – Jens
我忘了把它放在後... –
'$ tables [] = explode(「,」,$ doc);'$ doc是一個數組,這就是爲什麼。 –