开发者

undefined function base_url()

Why is this line not working in constants.php :-

define('FILE_UPLOAD_VIRTUAL_DIR', base_url() . '/uploads开发者_StackOverflow中文版/');

base_url() works in all views. Then why not in constants.php?


Probably because constants.php is included before the library defining base_url() is.

I don't know CI, but look if there is any chance to define the constant at a later point in the program flow. A CI expert may be able to tell you in more detail where exactly.


Try it like this:

define('FILE_UPLOAD_VIRTUAL_DIR', $_SERVER['DOCUMENT_ROOT'] . '/uploads/');

if you want to define path to file upload directory you don't need url you need path.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜