ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [php]iconv 함수가 잘 안된다면.. 만들어 쓰자!!
    카테고리 없음 2011. 2. 22. 00:21
    반응형
    if(!function_exists(iconv))
    {
    $p = popen("which iconv", "r");
    if($p)
    {
    $iconv_path = trim(fgets($p, 1024));
    fclose($p);

    $_checker = explode('/', $iconv_path);
    if(($_checker[count($_checker)-1])=="iconv")
    {
    function iconv($from, $to, $text)
    {
    global $iconv_path;

    $process = proc_open(
    $iconv_path." --from-code=".$from." --to-code=".$to,
    array(array("pipe", "r"),array("pipe", "w")),
    $pipes
    );

    fwrite($pipes[0],$text);
    fclose($pipes[0]);

    $result = '';
    while (!feof($pipes[1]))
    $result .= fgets($pipes[1], 024);
    fclose($pipes[1]);

    proc_close($process);

    return $result;
    }
    }
    }
    }
Designed by Tistory.