当我在PHP上编写代码时,我需要或导入.PHP文件,其中包含我需要的类和函数。例如`
<?php require("ffmpeg.php"); ?>
可能需要PHP文件,该文件在根目录上没有,但是存储在网站上,例如`
<?php require("http://example.com/ffmpeg.php"); ?>
如果是真实的,请帮助我解决这个问题。
使用file_get_contents,然后您需要将内容写入文件,或者可以使用eval直接执行。
//option 1 save to file
$contents = file_get_contents("http://example.com/ffmpeg.php");
file_put_content("yourphpfilename.php", $contents);
//option 2 get and execute
$contents = file_get_contents("http://example.com/ffmpeg.php");
eval($contents);