php - CSS 和 jQuery 文件上的 404

标签 php css twitter-bootstrap header

这是我的代码:

    <head>
        <link rel="stylesheet" href="http://localhost/css/estilos.css">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <script type="text/javascript" src="../js/jquery.min.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>

程序运行正常,但如果我使用 inspect 元素,我会收到这些警告。谁能帮我弄清楚?

Errors

希望你能帮助我:D

最佳答案

问题是您错误地链接到您的自己的 版本的 jQuery。 因为您已经从 CDN 加载它两次,所以您甚至不需要在本地加载它。只需从 CDN 加载最新版本的 jQuery 一次,不用担心加载本地副本:

<head>
    <link rel="stylesheet" href="/css/estilos.css">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>

请注意,您的 CSS 和 jQuery 都抛出了错误,这意味着您没有http://localhost/css/estilos.css。我在我的 anser 中使用了 /css/estilos.css/ 来引用 root。这会将 CSS 文件指向:[root]/css/estilos.css。根据您的文件结构,您可能需要改用 css/estilos.css/(没有前导斜线)。有关相对路径的更多信息,请查看 CSS Trick's article .

希望这对您有所帮助!

关于php - CSS 和 jQuery 文件上的 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42940934/

相关文章:

javascript - 将汉堡图标添加到 Bootstrap 侧边栏

javascript - 显示模态时隐藏下拉菜单

php日期格式转换问题

php - $_POST[] 保存数组...帮助

javascript - Angular 2 避免编译 CSS 中定义的图像

twitter-bootstrap - 在最后一张幻灯片和第一张幻灯片之间移动时,Bootstrap 显示白色背景

html - 可变高度列,背景颜色

php - file_get_contents() 没有响应 - php

php - 加密密码并存储在android上的数据库中

html - 使用 CSS 的水平菜单