134564 发表于 2014-11-28 09:55:14

php 字符串截取

php中没有一个和java ,c#一样的字符串分割成数组的方法,至少我没有找到.所以我自己写了一个分割字符串为字符数组的方法:
/**
* 我的字符串切分的函数
*/
function my_split($str, $seperator) {
        $str_array = array ();
        $token = strtok ( $str, $seperator );
        $index = 0;
        while ( $token !== false ) {
                $str_array [$index] = $token;
                $token = strtok ( $seperator );
                $index ++;
        }
        return $str_array;
}

页: [1]
查看完整版本: php 字符串截取