“严格标准:仅变量应通过引用传递".错误 [英] "Strict Standards: Only variables should be passed by reference" error

查看:103
本文介绍了“严格标准:仅变量应通过引用传递".错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据此处的代码获取基于HTML的递归目录列表:

I am trying to get an HTML-based recursive directory listing based on code here:

http://webdevel.blogspot.in/2008/06/recursive-directory-listing-php.html

代码运行正常,但会引发一些错误:

Code runs fine but it throws some errors:

严格标准:只有变量应通过引用传递给 第34行的C:\ xampp \ htdocs \ directory5.php

Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\directory5.php on line 34

严格标准:只有变量应通过引用传递给 第32行的C:\ xampp \ htdocs \ directory5.php

Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\directory5.php on line 32

严格标准:只有变量应通过引用传递给 第34行的C:\ xampp \ htdocs \ directory5.php

Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\directory5.php on line 34

下面是代码摘录:

else
  {
   // the extension is after the last "."
   $extension = strtolower(array_pop(explode(".", $value)));   //Line 32

   // the file name is before the last "."
   $fileName = array_shift(explode(".", $value));  //Line 34

   // continue to next item if not one of the desired file types
   if(!in_array("*", $fileTypes) && !in_array($extension, $fileTypes)) continue;

   // add the list item
   $results[] = "<li class=\"file $extension\"><a href=\"".str_replace("\\", "/",     $directory)."/$value\">".$displayName($fileName, $extension)."</a></li>\n";
  }

推荐答案

应该没问题

   $value = explode(".", $value);
   $extension = strtolower(array_pop($value));   //Line 32
   // the file name is before the last "."
   $fileName = array_shift($value);  //Line 34

这篇关于“严格标准:仅变量应通过引用传递".错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆