关于PHP中函数的返回值的问题
- PHP code
<!---ecms Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function Traverse_files($dir1,$dir2){ $dir = $dir1.'/'.$dir2; //print $dir; //exit; $ss = array(); if (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh)) !== false){ if($file!=="."&& $file!==".."){ $ss[]=$file; } } print_r($ss); return $ss; closedir($dh); } }}$dirbase = 'd:';$dirito<mark style="color:transparent">来4源gaodaimacom搞#代%码*网</mark><code>搞代gaodaima码</code> = '5-24';$bb = Traverse_files($dirbase,$dirito);printf($bb);
上代码,问题是上面retrun的值出不来。。$ss在上面可以打印出来。
如何解决。。
——解决方案——————–
printf() 函数输出格式化的字符串。 应该用 print_r($bb);