我希望能够通过一些变量发送到文件file_get_contents().
这是firstfile.php:
<?php
$myvar = 'This is a variable';
// need to send $myvar into secondfile.php
$mystr = file_get_contents('secondfile.php');
?>
Run Code Online (Sandbox Code Playgroud)
这是secondfile.php:
The value of myvar is: <?php echo $myvar; ?>
Run Code Online (Sandbox Code Playgroud)
我希望变量$mystr相等'The value of myvar is: This is a variable'
还有其他功能可以让你在PHP中执行此操作吗?