如何在不包含或要求该文件的情况下调用不同文件中的函数?
You can't. If you don't include or require it, PHP has no idea what's there. You can use .htaccess or php.ini to automatically include a file, which is identical to including it with require or include.
For example in .htaccess
php_value auto_prepend_file "/full/path/to/a/prepend-file.php"
In php.ini
auto_prepend_file = "/full/path/to/a/prepend-file.php"
Read it into a string and eval it.
$code = file_get_contents("somefile.php");
eval($code);
Copy and paste it. But mind the license.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.