Home  >  Article  >  Backend Development  >  protected static $member_id; //What does this line of code mean? I have never written it like this before, and I can’t understand what it does.

protected static $member_id; //What does this line of code mean? I have never written it like this before, and I can’t understand what it does.

WBOY
WBOYOriginal
2016-08-04 09:20:161534browse

protected static $member_id;

<code>class TokenController extends CommonController
{

    protected static $member_id;</code>

Reply content:

protected static $member_id;

<code>class TokenController extends CommonController
{

    protected static $member_id;</code>

static is a class member, not an object member.
protected means that only this class and derived classes can access it.

When a static class allows derived classes to access members, it is written like this

<code>    class A
    {
        public static $abc;
    
        protected static $bbc;
        
        public static function a()
        {
            return self.$bbc;
        }
    }

可以直接 A.$abc来访问$abc这个变量
A.a() 可以得到A.$bbc</code>

Class member variables, the control of this variable can only be controlled by functions, so it can be used when querying the code for set get.
Because only get set will change the value

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