【发布时间】:2021-05-05 06:56:52
【问题描述】:
hint.php 中的内容是“111”
<?php
class T{
public $filename = "hint.php";
function __destruct() {
var_dump(file_get_contents($this->filename));
}
}
new T();
得到了
string(3) "111"
而当我设置一个变量$t时,结果会不一样。
$t = new T();
得到了
string(0) ""
为什么会这样
【问题讨论】:
-
我无法重现您的结果。设置
$t = new T();我仍然得到我的hint.php的内容。 -
我的php版本是PHP Version 7.3.1 系统是windows