Codeigniter echoing [::1] instead of localhost

后端 未结 5 1638
误落风尘
误落风尘 2020-12-03 05:38

I am using CodeIgniter 3 as a web platform and trying to import semantic-UI CSS into my page. I\'m doing so by using CodeIgniter\'s base_url() method in the hre

5条回答
  •  误落风尘
    2020-12-03 06:17

    You need to edit your $config['base_url'] as follows,

    $config['base_url'] = '';
    $config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
    $config['base_url'] .= "://" . $_SERVER['HTTP_HOST'];
    $config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']);
    

    File location: codeigniter/application/config/config.php
    Use above code to get dynamic url.

提交回复
热议问题