徐兴ID:striker_un
2410次访问,排名2万外好友7人,关注者11
striker_un的文章
原创 8 篇
翻译 0 篇
转载 1 篇
评论 2 篇
最近评论
striker_un:常用查询字符串处理
function chk_query($word) {
global $skip_ary,$split_ary,$trans_ary;
$res = urldecode($word);
$res .= ' '.strtoupper($res);
$res = strtr($res,$split_ary);
DOLOY:16 yellow card ,4 red
文章分类
收藏
    相册
    徐兴
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 批量 gb->utf-8编码转换. (转)收藏

    新一篇: 简单的xml处理类. | 旧一篇: 关于js处理的一些公用代码收集.(代码+demo)

     

    <?
    //文件编码转换.
    function file_iconv($fromcode,$tocode,$file){
        
    $data = join('',file($file));
        
    if(preg_match('/charset='.str_replace('-','\-',$tocode).'/mis',$data)){
            
    echo "<font color='red'>$file  $tocode .</font>";
        }
        
    $data = preg_replace('/charset='.str_replace('-','\-',$fromcode).'/mis',"charset=$tocode",$data);
        
    $data = preg_replace('/(sets+namess+)''.str_replace('-','',$fromcode).''/mis',"\1'".str_replace('-','',$tocode)."'",$data);
        
    $data = iconv("$fromcode","$tocode",$data);
        
    $fp = fopen("$file","w");
        
    fwrite($fp,$data);
        
    fclose($fp);
        
    echo "$file ...<br>";
    }

    function listfiles($dir="."){
        
        
    $handle=opendir("$dir");
        
    while ($file = readdir($handle)) {
            
    if($file=="."||$file=="..")continue;
            
    if(is_dir("$dir/$file")){
                listfiles(
    "$dir/$file");
            }
            
    else {
                
    $ext = strtolower(strrchr($file,'.'));
                
    if(in_array($ext,array(".php",".html",".htm"))){
                    file_iconv(
    "gb2312","utf-8","$dir/$file");
                }
            }
        }
        
    closedir($handle);
    }

    listfiles(
    "mydir");
    ?>

    发表于 @ 2008年04月01日 10:40:00|评论(loading...)|编辑

    新一篇: 简单的xml处理类. | 旧一篇: 关于js处理的一些公用代码收集.(代码+demo)

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © striker_un