function wap_substr($string, $start, $length, $charset = 'UTF-8', $dot = false) { $start = $start ? $start : 0; $length = $length ? $length : 0; $string = $string ? $string : ''; if (in_array($charset, array('utf-8', 'UTF-8', 'utf8'))) { return utf8_substr($string, $start, $length, $dot); } else { return gbk_substr($string, $start, $length, $dot); } }
function format_substr($str, $slen, $ext = "") { global $_G; if ($_G['product']['charset'] == "utf-8") { return utf_substr($str, $slen, $ext); } else { return gbk_substr($str, $slen, $ext); } }