echo "<p align=left style='padding-left:10px'>联系人:{$sql_hotel['sc_contact']}<BR>电话:{$sql_hotel['sc_phone']}</p>"; } if ($option == 'showtraveltage') { $sql_hotel = $GETSQL->fSql("sc_tages", "`{$ODBC['tablepre']}travel`", "`sc_id`='{$id}'", "", "", "", "U_B"); $hot_tages = explode(",", $sql_hotel['sc_tages']); foreach ($hot_tages as $value) { $showtages .= " <a href='javascript:;' title='{$value}' onclick=\"showtextcontent('index.php?action=travel&option=showtage&Keyword='+escape('{$value}'))\">{$value}</a> "; } echo $showtages; } if ($option == 'showtravelattr') { include_once GetLang('image'); include_once Getincludefun("image"); $sql_hotelroom = $GETSQL->fSql("*", "`{$ODBC['tablepre']}travelattr`", "`attr_hid`='{$id}'", "ORDER BY `attr_date` DESC,`attr_id` DESC", 0, 6); foreach ($sql_hotelroom as $value) { echo "<li><a href='{$boardurl}index.php?action=travel&option=travelattr&id={$value['attr_hid']}&Industry={$value['attr_id']}' target='_blank'>" . fCharlen($value['attr_subject'], 0, 20) . "</a></li>"; } } if ($option == 'showtravelphoto') { include_once GetLang('image'); include_once Getincludefun("image"); $sql_hotelimage = $GETSQL->fSql("*", "`{$ODBC['tablepre']}travelimage`", "`hi_hid`='{$id}' AND `hi_pass`='1'", "ORDER BY `hi_date` DESC,`hi_id` DESC", 0, 6); foreach ($sql_hotelimage as $value) { echo "<li class='xspace-avatarlist xspace-imgstyle'><a href='{$boardurl}index.php?action=travel&option=travelphoto&id={$value['hi_hid']}&Industry={$value['hi_id']}' target='_blank'><img src='" . fimgsrc($value['hi_src'], 'simll/') . "' alt='{$value['hi_subject']}' /></a></li>"; } } if ($option == 'showtravelinfo') { $sql_hotel = $GETSQL->fSql("sc_info", "`{$ODBC['tablepre']}travel`", "`sc_id`='{$id}'", "", "", "", "U_B"); echo $sql_hotel['sc_info']; } if ($option == 'showtraveltraffic') {
function fKeyword($Keyword, $type = "0") { /* gb2312 0xa1-0xf7 0xa1-0xfe gbk 0x81-0xfe 0x81-0xfe 0x40-0x7e big5 0xa1-0xf7 0x81-0xfe 0x40-0x7e preg_match("/([0-9a-zA-z]+)(.*?)/si",$Keyword, $matches); foreach ($matches AS $k=>$value) { echo $k." = ".$value."<BR>"; } */ //preg_match("/([0-9a-zA-z]*)/si",$Keyword, $matches); if ($type == '0') { if (trim(ltrim($Keyword)) == '') { return $Keyword; } $k = 0; $Key = preg_replace("/([" . chr(0xa1) . "-" . chr(0xff) . "]+)/", "\\br\\1\\br", $Keyword); $Keywordarray = explode("\\br", $Key); if (is_array($Keywordarray)) { foreach ($Keywordarray as $value) { if (preg_match("/^[" . chr(0xa1) . "-" . chr(0xff) . "]+\$/", $value)) { $leng = "4"; } else { $leng = "2"; } //英文 $value = str_replace(",", "\\br", $value); $value = str_replace(".", "\\br", $value); $value = str_replace("\"", "\\br", $value); $value = str_replace("\"", "\\br", $value); $value = str_replace(" ", "\\br", $value); $value = str_replace(" ", "\\br", $value); $Keywords = explode("\\br", $value); foreach ($Keywords as $key) { $j = 0; if (strlen($key) > $leng) { $n = intval(strlen($key) / $leng) + 1; for ($i = 0; $i < $n; $i++) { $cst = fCharlen($key, $j, $leng, ""); if ($cst != $key) { $str[$k] = $cst; } $j += 2; $k++; } } elseif ($key != '') { $str[$k] = $key; $j += 2; $k++; } } } return $str; } } if (trim(ltrim($Keyword)) == '') { return $type; } if (preg_match("/^[" . chr(0xa1) . "-" . chr(0xff) . "]+\$/", $Keyword)) { $leng = "4"; } else { $leng = "2"; } //英文 $Keyword = str_replace(",", "\\br", $Keyword); $Keyword = str_replace(".", "\\br", $Keyword); $Keyword = str_replace("\"", "\\br", $Keyword); $Keyword = str_replace("\"", "\\br", $Keyword); $Keyword = str_replace(" ", "\\br", $Keyword); $Keyword = str_replace(" ", "\\br", $Keyword); $Keywords = explode("\\br", $Keyword); $k = 0; if ($type == '0') { foreach ($Keywords as $key) { $j = 0; if (strlen($key) > $leng) { $n = intval(strlen($key) / $leng) + 1; for ($i = 0; $i < $n; $i++) { $cst = fCharlen($key, $j, $leng, ""); if ($cst != $key) { $str[$k] = $cst; } $j += 2; $k++; } } elseif ($key != '') { $str[$k] = $key; $k++; } } //$str[$n] = $Keyword; } else { foreach ($Keywords as $key) { $j = 0; $n = intval(strlen($key) / $leng); if ($leng == '4') { $n += 1; } $type = preg_replace("/{$key}/si", "<font color=red>{$key}</font>", $type); for ($i = 0; $i < $n; $i++) { $keys = fCharlen($key, $j, $leng, ""); if ($keys != $key) { $type = preg_replace("/{$keys}/si", "<font color=red>{$keys}</font>", $type); } $j += 2; } } $str = $type; } return $str; }
$parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $buff, $values, $idx); xml_parser_free($parser); foreach ($values as $val) { $tag = $val["tag"]; $type = $val["type"]; $value = $val["value"]; //标签统一转为小写 $tag = strtolower($tag); if ($tag == "item" && $type == "open") { $is_item = 1; } else { if ($tag == "item" && $type == "close") { //构造输出字符串 echo "<div style=\"height:20px;\"><img src=\"image/lvyou/ico_right.gif\" width=\"4\" height=\"8\"> <a href=\"{$link}\" class=\"link_title_white\" target=_blank>" . fCharlen($title, 0, 30, "") . "</a></div>"; $is_item = 0; } } //仅读取item标签中的内容 if ($is_item == 1) { fgetposttoupdatd($value, 'gbk'); if ($tag == "title") { $title = $value; } if ($tag == "link") { $link = $value; } } } }