开发者

Error :Function must be terminated with a string in CodeIgniter's constants.php

开发者 https://www.devze.com 2023-01-08 23:29 出处:网络
While writing this line :- define(\'APPLICATION_ROOT\',$_SERVER(\'DOCUMENT_ROOT\') ); in constants.php in CodeIgniter framework of PHP i get error Error :Funct开发者_如何学Cion must be terminated wi

While writing this line :-

define('APPLICATION_ROOT', $_SERVER('DOCUMENT_ROOT') );

in constants.php in CodeIgniter framework of PHP i get error Error :Funct开发者_如何学Cion must be terminated with a string. Can i not use Super Global arrays in constants.php?


define('APPLICATION_ROOT', $_SERVER['DOCUMENT_ROOT'] );

Brackets [ ], not parentheses.

Though I will recommend against doing that. Constants are supposed to be, well, constant. $_SERVER['DOCUMENT_ROOT'] might not be defined or the same everywhere you use it.


I don't have an instance of CI up at the moment, but shouldn't that line be:

define('APPLICATION_ROOT', $_SERVER['DOCUMENT_ROOT']);

(With the square braces instead of parens)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号