문제

I have code

ActiveRecord\Config::initialize(function($cfg) {
  $cfg->set_model_directory("models");
  $cfg->set_connections(array("development" => "mysql://root:123@localhost/server"));
}

$server = new Server;

Why I get error

[Sun Nov 04 22:11:49 2012] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected T_VARIABLE in Server.php on line 27

on $server = new Server;

How to escape it?

도움이 되었습니까?

해결책

You have syntax error on the preceding line - you function is not finished. Try

 ActiveRecord\Config::initialize(function($cfg) {
  $cfg->set_model_directory("models");
  $cfg->set_connections(array("development" => "mysql://root:123@localhost/server"));
});

$server = new Server;

i.e. put ); on the preceding line.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top