Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设以下类
class test { public $x = 2; public testFunction() { //... } }
有什么方法可以从 testFunction() 中访问 $x 吗?
谢谢!:)
绝对,只需使用$this->x
$this->x
您可能希望复习PHP 的 OOP 原则。