Home > Backend Development > PHP Tutorial > CodeIgniter css样式不显示有关问题

CodeIgniter css样式不显示有关问题

WBOY
Release: 2016-06-13 11:56:23
Original
843 people have browsed it

CodeIgniter css样式不显示问题
这是我的引用css的代码

<br /><!DOCTYPE html><br /><html lang="en"><br /><head><br />	<title><?php echo $title ?> - News</title><br /><style type="text/css"><br /><link type="text/css" rel="stylesheet" href="<?=$this->config->item('base_url');?>css/yangshi.css" /><br /></style><br /></head><br /><body><br />	<h1>News</h1><br />
Copy after login

这是我的config.php的文件
<br />$config['base_url']	= 'http://127.0.0.1/myPhpStudy/index.php/';<br />
Copy after login

这是生成页面后的源代码,点击href连接显示404,我怀疑可能路径错误,可是我不知道哪里错了
    <!DOCTYPE html><br /><html lang="en"><br /><head><br />	<title>Create a news item - News</title><br /><style type="text/css"><br /><link type="text/css" rel="stylesheet" href="http://127.0.0.1/myPhpStudy/index.php/css/yangshi.css" /><br /></style><br /></head><br /><body><br />	<h1>News</h1><br /><br /><h2>Create a news item</h2>  <br />  <br />  <br />  <br /><form action="http://127.0.0.1/myPhpStudy/index.php/news/create" method="post" accept-charset="utf-8">  <br />     <br />    <label for="title">Title</label>  <br />    <input type="input" name="title" /><br /><br /><br />     <br />    <label for="text">Text</label>  <br />    <textarea name="text"></textarea><br />  <br />    <br/><br />        <br />    <input type="submit" name="submit" value="Create news item" />  <br /><span class="feifei">wsdfsfdsa</span><br /></body>  <br /></html>  
Copy after login

我的css文件夹和header.php页面都是在news文件夹下面的,不知道到底哪里错了,请大牛指点啊,本人是刚刚接触php的
------解决方案--------------------
http://127.0.0.1/myPhpStudy/index.php/css/yangshi.css" />
这是有效地路径吗?
难道 index.php 是目录?
------解决方案--------------------
base_url("css/yangshi.css");?>" />试试?
------解决方案--------------------
href=""这个在页面上打印出来的连接发出来看看
------解决方案--------------------
dirname($this->config->item('base_url'));?>css/yangshi.css" />
------解决方案--------------------
<link type="text/css" rel="stylesheet" href="<?=dirname($this->config->item('base_url'));?>/css/yangshi.css" />
Copy after login

------解决方案--------------------
贴出的的目录结构
并指出你的文件的位置
------解决方案--------------------
在网站直接输入http://127.0.0.1/myPhpStudy/index.php/css/yangshi.css能访问吗?是不是css这个目录限制访问的?
------解决方案--------------------
执行的文件为 myPhpStudy/index.php
样式表在 myPhpStudy/application/css 中
所以样式表的路径应为
dirname($this->config->item('base_url')) . '/application/css/'

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template