unexpected T_VARIABLE, expecting T_FUNCTION

前端 未结 5 1069

I am expecting this to be a basic syntax error I overlooked, but I can\'t figure it out.

In a PHP script, I keep getting the following error.

Parse e         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-15 18:26

    Use access modifier before the member definition:

        private $connection;
    

    As you cannot use function call in member definition in PHP, do it in constructor:

     public function __construct() {
          $this->connection = sqlite_open("[path]/data/users.sqlite", 0666);
     }
    

提交回复
热议问题