【发布时间】:2011-10-17 20:31:48
【问题描述】:
我希望能够通过file_get_contents() 将一些变量发送到文件中。
这是第一个文件.php:
<?php
$myvar = 'This is a variable';
// need to send $myvar into secondfile.php
$mystr = file_get_contents('secondfile.php');
?>
这是第二个文件.php:
The value of myvar is: <?php echo $myvar; ?>
我希望变量 $mystr 等于 'The value of myvar is: This is a variable'
还有其他函数可以让您在 PHP 中执行此操作吗?
【问题讨论】:
标签: php file-get-contents