我的字符串有问题
'Require.www' => false
此代码给出了错误:
>Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\xampp\KERNEL-DOCMS\Server.Config.php on line 5
我该如何解决这个问题?它位于在线游戏的serverconfig中。
完整的代码是:
## URL
$Config['URL'] =
'Default'
'Require.www' => false, // www.example.com
'SSL.enabled' => true, // https://
'Server' => '***', // public server
'Lang' => 'en_US' // GLOBAL.
,
'Other' =>
//'example.com' => ['Require.www' => false, 'SSL.enabled' => false, 'Lang' => 'es_ES', 'MySQL' => ['host' => '127.0.0.1','user' => 'root','pass' => '','dbname' => 'cmsdb']]
,
'devPrivateServer' => 'localhost' // private developer server
;
## SQL Server Data
$Config['MySQL'] =
'host' => '127.0.0.1',
'user' => '***',
'pass' => '***',
'dbname' => 'do'
;
// Do not tuch the code below this text if yuo do not know what yuo're doing
define( "DB_DSN", "mysql:host".$Config['MySQL'] ['host'].";dbname".$Config['MySQL']['dbname']."");//this constant will
define ( "DB_USERNAME", $Config['MySQL']["user"] ); //username of database
define ( "DB_PASSWORD", $Config['MySQL']["pass"] ); //username of database
define ( "CLS_PATH", "class" ); //the class path of our project
答案 0 :(得分:1)
这主要是语法错误。如果您要声明数组,请使用array()
或速记[]
:
$Config['URL'] = array(
'Default' => array(
'Require.www' => false, // www.example.com
'SSL.enabled' => true, // https://
'Server' => '***', // public server
'Lang' => 'en_US' // GLOBAL.
)
,
'Other' => ''
//'example.com' => ['Require.www' => false, 'SSL.enabled' => false, 'Lang' => 'es_ES', 'MySQL' => ['host' => '127.0.0.1','user' => 'root','pass' => '','dbname' => 'cmsdb']]
,
'devPrivateServer' => 'localhost' // private developer server
);
$Config['MySQL'] = array(
'host' => '127.0.0.1',
'user' => '***',
'pass' => '***',
'dbname' => 'do'
);