PHP警告:get_included_files()期望完全为0个参数,给出1

时间:2016-11-29 21:41:04

标签: php

我试图上传并使用我回过头来的旧脚本,但它给了我一个错误:

PHP警告:get_included_files()需要0个参数,在

中给出1
session_start();
ob_start();


get_required_files('config.php');
get_required_files('funksjoner.php');

1 个答案:

答案 0 :(得分:2)

get_required_filesget_included_files()的别名)不接受任何参数。它将返回包含所有包含文件的数组(includeinclude_oncerequirerequire_once)。

一个工作示例(来自get_included_files()的参考):

<?php
include 'test1.php';
include_once 'test2.php';
require 'test3.php';
require_once 'test4.php';

// Get all included files
$included_files = get_included_files();

// Loop the files and show the filenames
foreach ($included_files as $filename) {
    echo "$filename\n";
}
?>

如果您想要包含文件,只需使用&#34; include&#34;:

<?php
include 'config.php';
include 'funksjoner.php';
?>