有时间做开发时,不能输出直接输出的方法来调试,比如微信开发,哪怎么办呢?可以通过在服务器输出日志文件的方法来调试,方法如下:
<?php
$str="Hello World. Testing!122121";
$arr=array('3','4','5','6');
$s=implode("##",$arr);
debugResult($str);
function debugResult($str){
if(is_array($str)){
$s=implode("##",$str);
$temp=$s;
}else{
$temp=$str;
}
$file = fopen("debug_Result.txt","w");
echo fwrite($file,$temp);
fclose($file);
}//fun
?>