【发布时间】:2013-02-14 18:54:35
【问题描述】:
我是 Web 开发的新手(尤其是 CI 框架中的 php)。这个问题对你来说应该是一个非常简单的问题,但是我已经谷歌搜索了一个小时,仍然找不到任何解决方案。
我想显示一个图像(img 文件夹中的 logo.png)并链接一个我放入 的 css 文件(style 文件夹中的 style.css) >根目录:
但是当我尝试显示图像并链接 css 时,我得到的只是一个 blank 空 网页。 这是我的 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
- 手动输入网址
- 以多种方式更改
$config['base_url']值。 但是,它们都不起作用。
【问题讨论】:
-
http://localhost/ciGlassProject/img/logo.jpg可以工作吗? -
@pktangyue 是的,对不起,我想我只是想念输入网址:D
-
答案是:base(); url 不起作用,因为我忘了导入帮助程序 ($this->load->helper('url')) :D
标签: php html codeigniter