CodeIgniter css样式不显示有关问题
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 id="News">News</h1><br />
这是我的config.php的文件
<br />$config['base_url'] = 'http://127.0.0.1/myPhpStudy/index.php/';<br />
这是生成页面后的源代码,点击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 id="News">News</h1><br /><br /><h2 id="Create-nbsp-a-nbsp-news-nbsp-item">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>
我的css文件夹和header.php页面都是在news文件夹下面的,不知道到底哪里错了,请大牛指点啊,本人是刚刚接触php的
------解决方案--------------------
http://127.0.0.1/myPhpStudy/index.php/css/yangshi.css" />
这是有效地路径吗?
难道 index.php 是目录?
------解决方案--------------------
base_url("css/yangshi.css");?>" />试试?
------解决方案--------------------
href="=base_url("css/yangshi.css");?>"这个在页面上打印出来的连接发出来看看
------解决方案--------------------
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" />
------解决方案--------------------
贴出的的目录结构
并指出你的文件的位置
------解决方案--------------------
在网站直接输入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/'

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-
