what is the difference between site_url() and base_url()?

前端 未结 7 2121
南旧
南旧 2020-11-29 03:09

As I have read in some resources, base_url() and site_url() functions in codeigniter are almost the same, although my version of code

7条回答
  •  旧时难觅i
    2020-11-29 03:33

    I would like to add when to use base_url() and the site_url() . Basically one can use site_url() while creating links for controllers whereas base_url() can be used where we need to create urls for the assets like loading a css or js file or some image .

    What I always prefer is to use site_url() for creating links to controllers or ajax urls and base_url() for loading assets .

提交回复
热议问题