我的代码点火器的主题系统几乎完成了。

遇到样式表问题,错误403本地主机。

它正在我的另一个上运行,但是我的新版本无法使用

每个主题都有其样式表文件夹和Java脚本。大多数人说这样做是错误的,但是。这种方式对于主题系统来说更好。

主题/默认

主题/默认/样式表/stylesheet.css

主题/默认/javascript/common.js

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="" />
<meta name="keywords" content="" />
<title><?php echo $this->config->item('title'); ?></title>
<base href="<?php echo base_url(); ?>">
<link rel="stylesheet" type="text/css" href="application/views/theme/default/stylesheets/stylesheet.css" media="screen">
</head>


主题/ codeigniter

主题/ codeigniter / stylesheets / stylesheet.css

主题/codeigniter/javascript/common.js

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="" />
<meta name="keywords" content="" />
<title><?php echo $this->config->item('title'); ?></title>
<base href="<?php echo base_url(); ?>" >
<link rel="stylesheet" type="text/css" href="application/views/theme/codeigniter/stylesheets/stylesheet.css" media="screen" >
</head>

最佳答案

我认为Code Ignitor将撤消应用程序文件夹内的直接访问。因此,我将所有图像,CSS和JS以及应用程序,系统和用户指南全部放入CI ROOT FOLDER中的一个名为asset的文件夹中。

现在,在utility_helper.php中创建一个名为ROOT_FOLDER/application/helper的文件,并添加以下代码

<?php

function asset_url(){
   return base_url().'assets/';
}

?>


然后在第67行的application/config/autoload.php中添加实用程序

$autoload['helper'] = array('utility');


现在,当您要访问资产文件夹时,可以将其称为

<link rel="stylesheet" type="text/css" href="<?php echo asset_url();?>stylesheets/stylesheet.css" />

关于css - 样式表403禁止的本地主机Codeigniter,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23148533/

10-11 05:31
查看更多