php的乱码问题 大家帮忙看看http://zhidao.baidu.com/question/110068264.html就是像C#的这种功能 PHP有没有? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 出现类似逆流 的东西 我想把它转换成汉字然后入库 有办法吗? function translate($text,$language='ru|zh-cn'){ if(empty($text))return false; @set_time_limit(0); $html = ""; $ch=curl_init("http://google.com/translate_t?langpair=".urlencode($language)."&text=".urlencode($text)); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_HEADER,0); curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1); $html=curl_exec($ch); if(curl_errno($ch))$html = ""; curl_close($ch); if(!empty($html)){ $x=explode("</span></span></div></div>",$html); $x=explode("onmouseout=\"this.style.backgroundColor='#fff'\">",$x[0]); return $x[1]; }else{ return false; }}$conn=mysql_connect('localhost','root','root');mysql_select_db(demo,$conn);mysql_query("set names 'utf8'");echo translate('противоточная');$sql="INSERT INTO art(title,cont) VALUES ('我已经','$xxx')";mysql_query($sql); 怎样将MYsql的查询结果写入一个数据表 文章内容太长在php中如何做分页 php如何去除最后一个匹配字符? 关于实现网站多语言的思路 关于windows2003服务器上的require错误!坐等! 為什麼重置不了?? 请问百度搜索用的是什么原理,是怎么来实现的啊,大家可以讨论一下 在线等。。请问如何用链接传递一个变量的值? 配置中session在什么地方打开? 哪有友情自助连接的php源代码??(null) 网站制作入门,求高手给制定学习计划,用什么语言编,看什么书 论坛迁移后flock阻塞的问题
function translate($text,$language='ru|zh-cn'){
if(empty($text))return false;
@set_time_limit(0);
$html = "";
$ch=curl_init("http://google.com/translate_t?langpair=".urlencode($language)."&text=".urlencode($text));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
$html=curl_exec($ch);
if(curl_errno($ch))$html = "";
curl_close($ch);
if(!empty($html)){
$x=explode("</span></span></div></div>",$html);
$x=explode("onmouseout=\"this.style.backgroundColor='#fff'\">",$x[0]);
return $x[1];
}else{
return false;
}
}
$conn=mysql_connect('localhost','root','root');
mysql_select_db(demo,$conn);
mysql_query("set names 'utf8'");
echo translate('противоточная');
$sql="INSERT INTO art(title,cont) VALUES ('我已经','$xxx')";
mysql_query($sql);