关于PHP中函数的返回值的有关问题

WBOY
Release: 2016-06-13 13:30:18
Original
747 people have browsed it

关于PHP中函数的返回值的问题

PHP code
<!--

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 = '5-24';
$bb = Traverse_files($dirbase,$dirito);
printf($bb);

Copy after login




上代码,问题是上面retrun的值出不来。。$ss在上面可以打印出来。
如何解决。。

------解决方案--------------------
printf() 函数输出格式化的字符串。 应该用 print_r($bb);
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!