我是新來web開發(特別是在CI框架中的php)。這個問題對你來說應該是一個非常簡單的問題,但我一直在Google上搜索一個小時,但仍然找不到任何解決方案。網址來顯示圖像和連接css在codeigniter
我想顯示(在IMG文件夾logo.png)的圖像,並(在風格文件夾中的style.css),我把在根目錄鏈接一個CSS文件:
但是,當我試圖顯示圖像和鏈接的CSS,我得到的是空白空網頁。 這是我的html代碼:
<!DOCTYPE html>
<html>
<head>
<title>My First Design</title>
<link href="<?php echo base_url();?>style/style.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1><img src="../../img/logo.jpg" />My First Web Design</h1>
<p>
I have been working on honing, and in some cases, learning new graphical skills in the past few weeks. So, I have been extensively watching Adobe Illustrated tutorials and working on my existing Photoshop knowledge and basically trying to get a hang of the software beyond basic image editing and digital painting.
</p>
<p>
From a beginner’s point of view, the world of graphical design is quite vast… at times intimidating and there is no limit to creative options. One could branch out into any form of graphical design… illustrations or web-design or logo & advertising and so much more. At the same time, one does not need to limit the options to just these.
</p>
</body>
</html>
這是我config.php
BASE_URL:$config['base_url'] = 'http://localhost/ciGlassProject/';
我已經試過像一些不同的方法:
- 使用SITE_URL而不是BASE_URL
- 鍵入URL手動
- 以多種方式更改
$config['base_url']
的值。 但是,他們都沒有工作。
可以'http:// localhost/ciGlassProject/img/logo.jpg'工作嗎? – pktangyue 2013-02-28 14:31:10
@pktangyue是的,對不起,我想我只是想輸入網址:D – 2013-02-28 14:44:55
答案是:The base(); url不工作因爲我忘了導入幫助器($ this-> load-> helper('url')):D – 2013-02-28 14:52:48