gpt4 book ai didi

php - Bootstrap 3.3.7 与 codeigniter

转载 作者:行者123 更新时间:2023-11-28 16:03:08 25 4
gpt4 key购买 nike

我正在尝试使用 Bootstrap 导航栏,但它不起作用。我创建了一个模板文件夹,其中包含 View 中首页的 CSS。我的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title> TTS</title>
<link rel="stylesheet" href="<?php echo base_url("asset/css/bootstrap.css"); ?>" />

<style type="text/css">
#img{
display:block;
position:relative;
left:0px;
float:left;
margin-left:10px;
}
#img2{
display:block;
position:relative;
right:0px;
float:right;
margin-right:10px;
}
#img3{
display:block;
position:relative;
left:0px;
float:left;
}
</style>
</head>
<body>
<script type="text/javascript" src="<?php echo base_url("asset/js/jquery.js"); ?>"></script>
<script type="text/javascript" src="<?php echo base_url("asset/js/bootstrap.js"); ?>"></script>
</body>
</html>

View 的 php 文件是:

    <nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">TTS</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</nav>

Controller 是:

    <?php defined('BASEPATH') OR exit('No direct script access allowed');

class firstpage extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
$this->load->helper('html');
$this->load->helper('form');
}

public function index(){
$this->load->view('templates/front_template/front');
$this->load->view('front_page/firstpage');
}
} ?>

我可以在 this.searched 中得到帮助吗?到处都没有得到正确的答案。

最佳答案

检查它是否在您的 firefox firebug 或开发人员工具中的 url 中有 ip,如果有,请确保您已设置您的 base_url 它是必需的

$config['base_url'] = 'http://localhost/projectname/';

而你错过了 type="text/css"

并且无需使用 ?> 关闭 Controller

关于php - Bootstrap 3.3.7 与 codeigniter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39711735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com