我是Web开发的新手(尤其是CI框架中的php)。这个问题对你来说应该是一个非常简单的问题,但我一直在谷歌搜索一个小时,仍然无法找到任何解决方案。
我想在 img 文件夹中显示图片(logo.png)并链接我输入的强css文件(样式文件夹中的style.css) > root 目录:
但是当我试图显示图像并链接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/';
我尝试了一些不同的方式:
$config['base_url']
值。
但是,他们都没有工作。答案 0 :(得分:1)
您可以使用它应该运行的基本网址。
<img src="http://localhost/ciGlassProject/img/logo.jpg" />
更好的方法是使用php获取基本网址。这意味着如果你移动你的网站,你不必多次更改URL以使其在新的位置运行。为此你可以使用一个简单的php调用:
<img src="<?php echo base_url(); ?>img/logo.jpg" />