codeigniter 控制器和 controller/ 之间有什么区别?

what is the difference between codeigniter controller & controller/?

当我加载 url:

http://icetopup.tk/secure/login

有效。但是当我加载时:

http://icetopup.tk/secure/login/

它显示页面内容但没有 css。有人知道怎么解决吗?

我想您的模板中有 CSS 文件的相对路径。这两条路径在 CodeIgniter 中的作用相同,但从浏览器的角度来看,它们的含义却截然不同:

http://icetopup.tk/secure/login表示:目录'secure'中的资源'login',所以'/secure/'是相对路径的偏移目录。

http://icetopup.tk/secure/login/表示:默认文档来自目录'login',所以'/secure/login/'是相对路径的偏移目录。

要解决这个问题,请务必使用 base_url() 函数:

<link rel="stylesheet" href="<?=base_url()?>/css/yourfile.css">

<link rel="stylesheet" href="<?=base_url('css/yourfile.css')?>">

此函数位于 URL 帮助程序文件中,因此如果您尚未加载该函数,则需要加载它。

另请参阅: