Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

php - Access to undeclared static property $this

This is my class:

Class RUNcookieDescutes Extends DF_CookiesDescutes
{

   function RUNcookieDescutes($Cookietype)
   {

      // parent the faiamal father object
      parent::$this->EachDescute = array("fsr" => array(0,1), // order by date                  
                                         "prf" => array(0,1,5,10,15), // refrech page url
                                         "ths" => array(0,1), // type of signature
                                         "tps" => array(10,30,50,70), // size of reply pages
                                         "por" => array(0,1), // order by reply or not
                                         "psa" => array(0,1,2), // find the display fined
                                         "pfr" => array("absulot")); // selected forums posts
      // parent the faiamal father object
      if ($Cookietype == 0)
      {
         parent::findElementsDescuteCookie();
      }
      else
      {
         parent::findElementsDescuteSession();
      }
   }

}

The error I receive is this:

Fatal error: Access to undeclared static property: DF_CookiesDescutes::$this in C:xampphtdocscp_incclass_object.php on line 441

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The error is:

Access to undeclared static property: DF_CookiesDescutes::$this

In your code:

parent::$this->EachDescute

You can't use this syntax. If you want get/set EachDescute class property you have to use:

$this->EachDescute;

If the EachDescute is set as private, you can't get/set it from extended class.

The keyword parent:: is used to call a method of parent class (in extended class).

You can't use parent:: keyword to set a property (variable).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...