ad"/> ad">

Home  >  Article  >  Backend Development  >  php基础-种内部的动态成员变量

php基础-种内部的动态成员变量

WBOY
WBOYOriginal
2016-06-13 13:11:391019browse

php基础-类内部的动态成员变量

class TestClass{

????? function TestClass(){

??????????? $this->addAttr = "testtest";

????? }

?

????? function testAddAttr(){

?????????? echo $this->addAttr

???? }

?

}

说明:addAttr我们动态给类对象的一个变量,该变量只能在类内部使用,

Statement:
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