Home > Database > Mysql Tutorial > body text

Cannot access empty property

WBOY
Release: 2016-06-07 15:43:06
Original
1372 people have browsed it

致命错误:不能够进入此空值,位于E:\sunlion\web\down\class\db_sql.php 代码 ?php Class TestClass1{ var $class2; public function TestClass1(){ $this- $class2 = new TestClass2(); } } Class TestClass2{ var $aaaa="1111111"; } $ccc = new TestClas

致命错误:不能够进入此空值,位于E:\sunlion\web\down\class\db_sql.php

代码 
Class TestClass1{ 
var $class2; 
public function TestClass1(){ 
$this-> $class2 = new TestClass2(); 


Class TestClass2{ 
var $aaaa="1111111"; 

$ccc = new TestClass1(); 
echo $ccc-> $class2-> $aaaa; 
?>

错误的地方: 
$this-> $class2 = new TestClass2(); 
改为$this-> class2 = new TestClass2(); 
$this-> 后的变量不带$符

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!