VARIABLE, expecting T

I keep getting the following error in PHP:

Parse error: syntax error, unexpected '$date' (T_VARIABLE), expecting function (T_FUNCTION) in your code on line 3

With the following code:

<?php
 require("/edconfig.php");
 class EasyDevop{
  $date = new DateTime();
  $date->format('Y-m-d H:i:s');
  function dataLog($dataLog=""){
   file_put_contents($fileLog, $dataLog);
  }
  function newPage($filedirnametype=""){
   if(!file_exists($filedirnametype)){
    $handleFile = fopen($filedirnametype, "w");
    dataLog($filedirnametype."; ".$date."n");
   } else{
    echo "<b>Unable to create your page! It possibly already exists.</b>";
   }
  }
 }
?>

And I have tried everything, but I simply can't get it fixed. Can anyone please help me?

I'm new to PHP OOP.


在官方PHP文档中查看面向对象的编程:http://php.net/manual/en/language.oop5.php

链接地址: http://www.djcxy.com/p/58070.html

上一篇: Php:解析错误预计T

下一篇: VARIABLE,期待T