设为首页收藏本站language→→ 语言切换

鸿鹄论坛

 找回密码
 论坛注册

QQ登录

先注册再绑定QQ

查看: 1627|回复: 0
收起左侧

linux下的内码转换

[复制链接]
发表于 2010-2-24 13:43:56 | 显示全部楼层 |阅读模式
<OL><LI><CODE><FONT face=新宋体>&lt;?php </FONT></CODE><LI><CODE><FONT face=新宋体>function myiconv($inCharset,$outCharset,$str) </FONT></CODE><LI><CODE><FONT face=新宋体>{ </FONT></CODE><LI><CODE><FONT face=新宋体>  $tempfile = "/tmp/".<A href="http://www.php.net/manual/zh/function.rand"><U><FONT color=#0000ff>rand</FONT></U></A>(10000,99999); </FONT></CODE><LI><CODE><FONT face=新宋体>  <A href="http://www.php.net/manual/zh/function.exec"><U><FONT color=#0000ff>exec</FONT></U></A>("echo ".$str."&gt;&gt; ".$tempfile); </FONT></CODE><LI><CODE><FONT face=新宋体>  $str = <A href="http://www.php.net/manual/zh/function.exec"><U><FONT color=#0000ff>exec</FONT></U></A>("iconv -f ".$inCharset." -t ".$outCharset." ".$tempfile); </FONT></CODE><LI><CODE><FONT face=新宋体>  <A href="http://www.php.net/manual/zh/function.exec"><U><FONT color=#0000ff>exec</FONT></U></A>("rm -f ".$tempfile); </FONT></CODE><LI><CODE><FONT face=新宋体>  return $str; </FONT></CODE><LI><CODE><FONT face=新宋体>} </FONT></CODE><LI><CODE><FONT face=新宋体>//echo myiconv("gb2312","UTF-8","中华人民共和国"); </FONT></CODE><LI><CODE><FONT face=新宋体>?&gt;</FONT></CODE></LI></OL><RE> 转换文件: exec('iconv -f '.$inCharset.' -t '.$outCharset.' -o '.$file.' '.$file); </PRE>
您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2024-4-27 00:07 , Processed in 0.117980 second(s), 10 queries , Redis On.  

  Powered by Discuz!

  © 2001-2024 HH010.COM

快速回复 返回顶部 返回列表