小编Ric*_*ton的帖子

PHP将变量发送到file_get_contents()

我希望能够通过一些变量发送到文件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中执行此操作吗?

php file-get-contents

10
推荐指数
3
解决办法
3万
查看次数

标签 统计

file-get-contents ×1

php ×1