$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> ';
posted on 2011-03-30 18:09  李辉明  阅读(264)  评论(0编辑  收藏  举报