$root = new FileSystemNode("~", true);
$desktop = new FileSystemNode("Desktop", true);
$root->children[$desktop->name] = &$desktop;
...
$q = &$root->children["Desktop"];
unset($q);
我正在做这个奇怪的事情只是为了了解这段代码背后发生了什么。
真实场景:创建和连接对象后(在前 3 行中),我可能想将“桌面”分配给代码中某处的变量,然后我可能想删除它。但是,不幸的是,它根本没有被删除。我仍然可以访问 $root->children["Desktop"]。
有什么建议吗?