我有一个名为1.php的文件,而我有另一个名为index.php的文件
我使用
include('index.php');
包括索引数据。有什么方法可以将数据传递到index.php文件吗?
如果index.php位于1.php内,则可以这样做:
1.php:
<?php $variable = "hello";
include('index.php');
?>
index.php
<?php
echo $variable; //this will output hello.
?>