$values = '我晕<回车>我晕晕<回车>我晕晕晕';
$values = str_replace("\n", ", ", $values);
结果:$values = '我晕, 我晕晕, 我晕晕晕';
$html .= '<select name="attr_value_list[]">';
$html .= '<option value="">' .$GLOBALS['_LANG']['select_please']. '</option>';
$attr_values = explode("\n", $values);
foreach ($attr_values AS $opt)
{
$opt = trim(htmlspecialchars($opt));
$html .= ($val['attr_value'] != $opt) ?
'<option value="' . $opt . '">' . $opt . '</option>' :
'<option value="' . $opt . '" selected="selected">' . $opt . '</option>';
}
$html .= '</select> ';
$values = str_replace("\n", ", ", $values);
结果:$values = '我晕, 我晕晕, 我晕晕晕';
$html .= '<select name="attr_value_list[]">';
$html .= '<option value="">' .$GLOBALS['_LANG']['select_please']. '</option>';
$attr_values = explode("\n", $values);
foreach ($attr_values AS $opt)
{
$opt = trim(htmlspecialchars($opt));
$html .= ($val['attr_value'] != $opt) ?
'<option value="' . $opt . '">' . $opt . '</option>' :
'<option value="' . $opt . '" selected="selected">' . $opt . '</option>';
}
$html .= '</select> ';