在我的项目中,href 有问题。
我的 html 页面是 a.php,它的代码是:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="http://www.ulpin.com /css/bootstrap.min.css">
<style>
dd{word-wrap:break-word;};
</style>
<title>SystemTitle</title>
<script type="text/javascript" src="static/js/jquery-1.7.2-min.js"> </script>
<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
<base target="_self"/>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<div class="container">
<center>
<a href="active.php" class="btn">ManTest</a><br/><br/>
</center>
</div>
</body>
</html>
但它工作失败。于是我用firefox查看了页面源码,点击static/js/jquery-1.7.2-min.js的href时,显示:
Not Found
The requested URL /o1ws1v/web/admin/static/js/jquery-1.7.2-min.js was not found on this server.
src 已更改。"/o1ws1v/web/admin/" 自动添加。
为什么?
我的折叠结构是:
/yjdata/www/www/o1ws1v/web/admin/a.php
/yjdata/www/www/o1ws1v/web/static/js/jquery-1.7.2-min.js
/yjdata/www/www/o1ws1v/web/static/js/bootstrap.min.js
否则,将 a.php 放在 /yjdata/www/www/o1ws1v/web/ 中,它可以正常工作
谁能帮我?
这是一个简单的路径问题。
当您/yjdata/www/www/o1ws1v/web/admin/a.php
使用时src="static/js/jquery-1.7.2-min.js"
,会发生以下情况:
--/yjdata/www/www/o1ws1v/web/admin/
| |--- a.php <-- You are here
| |--- static/ <-- This is where the browser think that the static folder exists
|--- static/ <-- This is where the folder really is !
因此,您需要a.php
在 src 路径中上一级:
<script type="text/javascript" src="../static/js/jquery-1.7.2-min.js"> </script>
该..
指示父目录。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句