我似乎无法弄清楚这一点。我有 4 个多复选框并使用 implode 存储它们......然后尝试用爆炸来抓取它们进行比较。我需要显示带有检查值的表单,因此我需要查看他们检查的内容并默认显示该框以供管理员查看。Explode 似乎没有工作,因为它将字符串存储在索引 0 上
存储到数据库:
$pulled = implode(",",$pulled);
从数据库中检索
<?php
$pulled = '{pulled}'; // (expression engine CMS field)
echo "before Explode: $pulled <br>";
// returns: before Explode: Tanker,End/Bottom Dump,Flatbed,Van
$pulled = explode(",",$pulled);
echo "after Explode: <br>";
var_dump($pulled);
// returns: after Explode:
array(1) { [0]=> string(8) "Tanker,End/Bottom Dump,Flatbed,Van" }
$pos = strpos($pulled[0], 'Tanker');
if ($pos === false) {
echo "<br><br>The string 'Tanker' was not found in the string '$pulled[0]'";
} else {
echo "<br>The string 'Tanker' was found in the string '$pulled[0]'";
}