//调试工具 php中直接调用即可
function consoleLog($val){
$debug = debug_backtrace();
unset($debug[0]['args']);
echo '<script> try{',
'console.log('. json_encode(str_repeat ( "—" , 80 )). ');',
'console.log('. json_encode($debug[0]). ');',
'console.log('. json_encode($val). ');',
'console.log('. json_encode(str_repeat ( "—" , 80 )). ');',
'}catch(e){}</script>';
function consoleLog($val){
$debug = debug_backtrace();
unset($debug[0]['args']);
echo '<script> try{',
'console.log('. json_encode(str_repeat ( "—" , 80 )). ');',
'console.log('. json_encode($debug[0]). ');',
'console.log('. json_encode($val). ');',
'console.log('. json_encode(str_repeat ( "—" , 80 )). ');',
'}catch(e){}</script>';
};
//汉字截取工具
function chineseSubStr($str,$start,$len){
$strlen=$start+$len;
$tmpstr="";
for($i=0;$i<$strlen;$i++){
if(ord(substr($str,$i,1))>0xa0){
$tmpstr.=substr($str,$i,2);
$i++;
} else{
$tmpstr.=substr($str,$i,1);
}
}
return $tmpstr;
}