我正在学习 PHP 中的类和对象,我真的很困惑。这是我到目前为止所拥有的:
<?php
class ipInfo {
public $test1 = 'test';
}
$test = new ipInfo();
echo $test->$test1;
?>
每当我运行它时,我都会收到以下错误:
Notice: Undefined variable: test1 in //// on line 9
Fatal error: Cannot access empty property in //// on line 9