codeigniter站点_url()不工作

codeigniter站点_url()不工作,codeigniter,Codeigniter,控制器 看法 没有错误消息,但它不工作。这是查看源代码 <link rel="stylesheet" type="text/css" href="http://localhost:80/RestaurantManagementSystem/index.php/assets/styles/res.css"> 你想调用你的样式表吗? 试试这个: <link href="<?=style_url('assets/styles/res.css'); ?>" rel="st

控制器

看法

没有错误消息,但它不工作。这是查看源代码

<link rel="stylesheet" type="text/css" href="http://localhost:80/RestaurantManagementSystem/index.php/assets/styles/res.css">

你想调用你的样式表吗? 试试这个:

<link href="<?=style_url('assets/styles/res.css'); ?>" rel="stylesheet" type="text/css"/>

实际上,您需要清楚地了解站点url和基本url。每当你访问网站相关链接时,你都可以这样给链接

site_url('events/eventFrom/'.$date) 
但是,如果您试图访问您网站的目录特定内容,如images/css/javascript等,那么此时您需要使用base_url。 在您的情况下,链接类似于:

href="<?php echo base_url('assets/styles/res.css')?>

通过application->config->config.php,在配置文件中进行如下更改

$config['index_page'] = 'index.php';


然后,您的站点url和基本url将完美工作

在config中检查config.php

$config['base_url'] = 'http://localhost:80/RestaurantManagementSystem';
你对未来的看法如何

<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/styles/res.css')?>" />

试试base_url insteadit也不起作用,但它不起作用在这里是不够的,总是发布预期输出@user3840485我想本地主机是问题所在,对吗?codeigniter中没有名为style_url的函数,除非您也创建了一个帮助程序发布该代码
$config['index_page'] = '';
$config['base_url'] = 'http://localhost:80/RestaurantManagementSystem';
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/styles/res.css')?>" />