curl_init回来的编码怎么判断?个别文字乱码求解!
代码如下:
<br /><?php<br />$url = "http://zhidao.baidu.com/link?url=pTwcJotQ02pjg-mjCnc-fkw8ONOY9x8q0ESrCFhdVJy47agZnDnCb-BCAtngRGDt9yi0TvleSS_w0aPj8Vsk0atVkVhNYdZADN0kv0BzNau";<br /><br />echo fopen_url($url);<br />function fopen_url($url) <br />{ <br /> if (function_exists('curl_init'))<br /> { <br /> $curl_handle = curl_init(); <br /> curl_setopt($curl_handle, CURLOPT_URL, $url); <br /> curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT,2); <br /> curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER,1); <br /> curl_setopt($curl_handle, CURLOPT_FAILONERROR,1); <br /> curl_setopt($curl_handle, CURLOPT_TIMEOUT,2);<br /> $file_content = curl_exec($curl_handle);<br /> $encode = mb_detect_encoding($file_content, array("ASCII","UTF-8","GB2312","GBK","BIG5")); <br /> if($encode != "UTF-8")<br /> {<br /> $file_content = mb_convert_encoding($file_content, "UTF-8", $encode);<br /> //$file_content = iconv($encode,'utf-8//IGNORE',$file_content);<br /> }<br /> curl_close($curl_handle); <br /> }<br /> else<br /> { <br /> $file_content = ''; <br /> } <br /> return $file_content; <br />}<br />?><br /><br />