我有Codeigniter URL的問題。我有一個控制器「的welcome.php」:Codeigniter圖像和源URL
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$data['tiung'] = 'index';
$this->load->view('welcome_message',$data);
}
public function dor($bus)
{
$data['tiung'] = $bus;
$this->load->view('welcome_message',$data);
}
}
和視圖「welcome_message.php」:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
sesuatu <?php echo $tiung?>
<img src="fragor.jpg" width="720" height="246" alt=""/>
ladalah
</body>
</html>
如果我想我用這個參數來訪問控制器功能「多爾」 :
localhost/hostname/index.php/welcome/dor/something
它的工作原理,但問題是圖像未加載。我試圖把圖像文件放入webroot文件夾,'application'文件夾,甚至是'views'文件夾中。但圖像仍然無法加載。我應該在哪裏放置圖像文件?
資產的文件夾或文件夾的CSS,然後使用SITE_URL funtion等SITE_URL( '資產/ fragor.jpg'); – Rooster