如何从include(.inc)文件中调用php文件的函数


How to call a function of a php file from an include(.inc) file?

我尝试的代码是:

example.php

function test() 
{
    echo "Function is called";
}

test_include.inc

include_once("example.php");
test();

@arun-kumar,你应该在test_include中声明这个函数。Inc .并将其包含在example.php中。example.php是将要执行的文件。但是你也可以在另一个php文件中包含一个php文件或者在另一个inc文件中包含一个inc文件