php将编码转换为UTF8
主要用于编码不统一导致出现乱码的情况,此函数会自动监测非UTF8编码转成UTF8编码。
functionConverCode($str){
$encode=mb_detect_encoding($str,array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
$newstr=mb_convert_encoding($str,'UTF-8',$encode);
return$newstr;
}
主要用于编码不统一导致出现乱码的情况,此函数会自动监测非UTF8编码转成UTF8编码。
functionConverCode($str){
$encode=mb_detect_encoding($str,array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
$newstr=mb_convert_encoding($str,'UTF-8',$encode);
return$newstr;
}远程提交方式:post范围:所有php类型程序函数代码functionpost($params,$url){ $ch=curl_init(); curl_setopt($ch,CURLOPT_UR...
对字段中的连续空格进行删除只保留一个。应用案例$txt="abcytecn1"; $name=RemoveMoreSpaces($sss); echo$name;输出结果为:a...
获取当前目录下文件夹的名称应用案例$url="D:/wwwroot/ytecn.com/ui/"; $list=GetDirsInDir($url); print_r($lis...
获取当前目录下指定类型文件列表,比如或者txt文件,jpg文件等等。应用案例$url="D:/wwwroot/ytecn.com/txt/"; $list=GetFilesInD...
保存数据的时候,为了安全考虑,会用到这类功能,清除一串代码内所有的PHP代码。应用案例$url="1asasdasdas<?phpecho'ssss'?>&quo...