- 论坛徽章:
- 0
|
代码如下:
class Test
{
public $str = "直接用 :: 引用.";
function __construct()
{
$this->str = "赋值后引用.";
}
function show()
{
echo '$str = ',$this->str,'<br />';
}
}
$t = new Test();
echo '<br />';
$t->show();
Test::show(); |
运行结果:
$str = 赋值后引用.
$str =
Fatal error: Using $this when not in object context in D:\web_root\dflash\index.php on line 35
请各位指教,谢谢 ! |
|