<分区>
我正在尝试根据此处的代码获取基于 HTML 的递归目录列表:
http://webdevel.blogspot.in/2008/06/recursive-directory-listing-php.html
代码运行良好,但会抛出一些错误:
Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\directory5.php on line 34
Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\directory5.php on line 32
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";
}