开发者

undefined function base_url()

开发者 https://www.devze.com 2023-01-10 17:47 出处:网络
Why is this line not working in constants.php :- define(\'FILE_UPLOAD_VIRTUAL_DIR\',base_url() . \'/uploads开发者_StackOverflow中文版/\');

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

精彩评论

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

关注公众号