我正在使用Xampp来测试我的perl cgi脚本。当我打开cgi脚本时,css似乎不适用于该页面。我在html文件中尝试了完全相同的代码并且工作正常,这表明html链接到正确的位置以找到CSS。
$self->{content}=<<HTML;
<!DOCTYPE html>
<html>
<head>
<title>$title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="../css/additional.css" rel="stylesheet" media="screen">
<script src="http://code.jquery.com/jquery.js"></script>
<script src="../js/bootstrap.min.js"></script>
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<a class="brand" >Bridge : $env </a>
<ul class="nav">
<li><a href="#"><i class="icon-upload"></i>upload</a></li>
<li><a href="#"><i class="icon-search"></i>Search</a></li>
<li><a href="#"><i class="icon-cog"></i>Admin</a></li>
</ul>
</div>
</div>
<div class="container">
...
</div>
</body>
</html>
HTML
答案 0 :(得分:5)
本地主机/ XAMPP /的cgi-bin /网络/ CSS / bootstrap.min.css
您的Web服务器可能已配置为将cgi-bin
中的所有内容视为可执行文件。
CSS不是服务器可以解释的编程语言,因此当您尝试加载时,它可能会提供500错误。
请勿在{{1}}中保留静态资源。
答案 1 :(得分:-1)
也许可以使用http连接进行测试:
类似于:<link rel="stylesheet" href="http://192.168.0.32/bootstrap/css/bootstrap.min.css" media="screen">
这是我的脚本(非常非常脏):
#!/usr/bin/perl
use CGI qw(:standard);
print header;
print_hdetails();
print"<body data-spy=\"scroll\" data-target=\"\.bs-docs-sidebar\">\n";
print_navbar();
print_headerofpage();
print_mysidebar();
print_mybodycontent();
print end_html;
sub print_hdetails{
print <<FORMULE;
<!DOCTYPE html>
<html>
<head>
<base href="http://192.168.0.32/cgi-bin/"><!--[if lte IE 6]></base><![endif]-->
<title>bootstrapstyle page</title>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- for Bootstrap -->
<script type="text/javascript" src="http://192.168.0.32/bootstrap/jquery/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="http://192.168.0.32/bootstrap/js/bootstrap.min.js"></script>
<link href="http://192.168.0.32/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<!--link href="http://192.168.0.32/silverstripe/themes/bootstrap/css/myadded.css" rel="stylesheet" media="screen"-->
<!--link rel="shortcut icon" href="http://192.168.0.32/silverstripe/themes/bootstrap/images/favicon.ico" /-->
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--link rel="stylesheet" type="text/css" href="themes/bootstrap/css/form.css?m=1373645318" /-->
</head>
FORMULE
}
sub print_headerofpage {
print <<CONTENT;
<header class="jumbotron subhead" id="overview">
<div class="container">
<p>
<h2>bonjour!</h2><br>
</p>
</div>
</header>
CONTENT
}
sub print_mysidebar{
print <<MYSIDEBAR;
<div class="container">
<div class="row-fluid">
<div class="span2">
<h6>Sidebar content</h6>
<p>
class=span2
</p>
<ul class="nav nav-list bs-docs-sidenav">
<li><a href="#components"><i class="icon-chevron-right"></i> 1. Choose components</a></li>
<li><a href="#plugins"><i class="icon-chevron-right"></i> 2. Select jQuery plugins</a></li>
<li><a href="#variables"><i class="icon-chevron-right"></i> 3. Customize variables</a></li>
<li><a href="#download"><i class="icon-chevron-right"></i> 4. Download</a></li>
</ul>
</div>
MYSIDEBAR
}
sub print_mybodycontent{
print <<MYBODYCONTENT;
<div class="span10">
<h1>Hello, world! </h1>
<p>
ici c'est le body content class=span10
</p>
<p>
<h4>Le sourire, il fait plaisir a ceux qui vous aiment. Il emmerde ceux qui vous detestent. </h4>
</p>
</div>
MYBODYCONTENT
}
sub print_navbar {
print <<LANAVBAR;
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="./index.html">Bootstrap</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="">
<a href="./index.html">Home</a>
</li>
<li class="">
<a href="./getting-started.html">Get started</a>
</li>
<li class="">
<a href="./scaffolding.html">Scaffolding</a>
</li>
<li class="">
<a href="./base-css.html">Base CSS</a>
</li>
<li class="">
<a href="./components.html">Components</a>
</li>
<li class="">
<a href="./javascript.html">JavaScript</a>
</li>
<li class="active">
<a href="./customize.html">Customize</a>
</li>
</ul>
</div>
</div>
</div>
</div>
LANAVBAR
}
它对我有用。