Skip to content

Fatal error: Uncaught Error: Cannot access private property #51

Open

Description

@xyz-caibing

class App
{
private $rootPath;
}
class Load
{
public static function register(App $app)
{
self::$namespaceMap = [
'Framework' => $app->rootPath
];
}
}
这里的app->rootPath 是私有的,应该只有App类内部可以使用

Activity

  1. TIGERB commented on May 13, 2021

    @TIGERB
    Owner
    /**
         * 魔法函数__get
         *
         * @param  string $name  属性名称
         * @return mixed
         */
        public function __get($name = '')
        {
            return $this->$name;
        }
    
        /**
         * 魔法函数__set
         *
         * @param  string $name   属性名称
         * @param  mixed  $value  属性值
         * @return mixed
         */
        public function __set($name = '', $value = '')
        {
            $this->$name = $value;
        }
    

    魔术方法控制了的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions