收录日期:2020/11/26 23:40:49 时间:2010-09-07 23:14:50 标签:php,cakephp,syntax-error

Ok, sorry for this upcoming rookie question..

I was looking for a good user management plugin for cake, and i was recommended Authsome (if someone knows anything better>> plz recommend).

Anyway, i'm trying to set it up using the git's readme (very simple) but im running into a problem: t_string error. Code:

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /Applications/XAMPP/xamppfiles/htdocs/trainer/app/controllers/users_controller.php on line 7

Code users_controller:

<?php
class UsersController extends AppController {

 var $name = 'Users';
 var $scaffold;

 $guest = Authsome::get();
 debug($guest);


}
?>

So, its basic-the-la-basic.. but its driving me nuts! Could anyone plz help me? thx in advance...

You will want to put your executing code inside a function. It's illegal at this point in the class.

class UsersController extends AppController {

  var $name = 'Users';
  var $scaffold;

  function myMethod() {
    $guest = Authsome::get();
    debug($guest);
  }

}