2 回答

TA贡献1725条经验 获得超8个赞
您可以将变量存储在类中,然后使用 getter 方法取回该数据。文件1.php
if(isset($_POST['submit'])){
$data = new MyData($_POST['test']);
}
class MyData{
private $data = '';
function __construct($test){
***some process***
$data = $test;
}
function getData() {
return $this->data;
}
}
文件2.php
include file1.php;
echo $data->getData();

TA贡献1780条经验 获得超5个赞
我声明了一个函数并返回到第 1 页next.php
function showContent($content){
if(!empty($content)){
return $content;
}
return false;
}
然后在 上class.php,我声明一个吸气剂作为Karim Aljandali先生的答案。在第 1 页上,我添加了一行$next = showContent($data->getData());
- 2 回答
- 0 关注
- 290 浏览
添加回答
举报