How do I call开发者_Python百科 a function which is in a different file without including or requiring that file?
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.
精彩评论