【发布时间】:2015-06-17 04:30:31
【问题描述】:
当我创建 MVC 应用程序时,Bootstrap 样式没有访问。我的 .htaccess 文件是这样的
RewriteEngine on
RewriteRule !.(js|css|ico|gif|jpg|png|swf|ttf|eot|svg|woff|GIF)$ index.php
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
我的html编码是这样的
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>efrg</h1>
</body>
</html>
删除 .htaccess 文件后,它可以正常工作。 .htaccess 文件有什么问题?我也正确集成了 bootstrap.min.css 文件
这是我的 mvc 代码
<?php
$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$urlParams = explode('/', $url);
if (count($urlParams) === 5) {
header("location:$url"."users/login");
} else {
$modelName = $urlParams[4] . 'Model';
require "./model/$modelName.php";
$controllerName = $urlParams[4] . 'Controller';
require "./controller/$controllerName.php";
$actionName = $urlParams[5] . 'Action';
$obj = new $controllerName();
$obj->$actionName();
include "./view/$urlParams[4]/$urlParams[5].php";
}
?>
【问题讨论】:
-
什么是没有工作的css或js指定
-
我没有找到你@abhi Ahere
-
你的问题不明确
-
我的引导样式不起作用。
-
当您使用 .htaccess 时,如果您提供绝对路径,则可以访问每个文件
标签: php css .htaccess twitter-bootstrap