site_url changes localhost to [::1]

后端 未结 1 1134
离开以前
离开以前 2021-01-25 00:28

I\'ve used CodeIgniter before and it\'s been quite a long time since I\'ve last used it so I\'m basically going back to step 1.

I have the controller CaseCon with the fo

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-25 00:52

    I would think You have your base_url blank.

    $config['base_url'] = '';
    

    That is why [::1] You don't have set your base_url but that is what will happen

    Set your base url

    $config['base_url'] = 'http://localhost/your_project_name/';
    

    Or

    $config['config_base_url'] = 'http://localhost:8888/your_project_name/';
    

    Note: Your class and file name only have first letter upper case.

    File name: Casecon.php

    class Casecon extends CI_Controller {
    
      public function index() {
    
      }
    }
    

    It might work on localhost the way you have it but on some live servers you will run into issue.

    View form

    How to create a Controller

    How to create a Model

    0 讨论(0)
提交回复
热议问题