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
Release: 2016-08-04 09:20:16
Original
1532 people have browsed it

protected static $member_id;

<code>class TokenController extends CommonController
{

    protected static $member_id;</code>
Copy after login
Copy after login

Reply content:

protected static $member_id;

<code>class TokenController extends CommonController
{

    protected static $member_id;</code>
Copy after login
Copy after login

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>
Copy after login

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

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