Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php css链接未被识别_Php_Html_Css - Fatal编程技术网

Php css链接未被识别

Php css链接未被识别,php,html,css,Php,Html,Css,这是一个奇怪的。至少对我来说是这样。我有一个由PHP生成的HTML页面,其中链接了一个样式表(css.PHP)。我最初的计划是能够将该文件的属性保存在MySQL数据库中,然后在每次加载页面时使用PHP变量将值加载到该文件中。我被说服了,因为在每次加载页面时,它将使用许多服务器资源来解析这个文件。我决定每次更改数据库时都重写这个文件。现在,我已经用preferences.php编写了一个文件,并将其名称更改为css.css,它不再看到正确的文件。它只看到我在最初设置代码时编写的一行文件。现在我有了

这是一个奇怪的。至少对我来说是这样。我有一个由PHP生成的HTML页面,其中链接了一个样式表(css.PHP)。我最初的计划是能够将该文件的属性保存在MySQL数据库中,然后在每次加载页面时使用PHP变量将值加载到该文件中。我被说服了,因为在每次加载页面时,它将使用许多服务器资源来解析这个文件。我决定每次更改数据库时都重写这个文件。现在,我已经用preferences.php编写了一个文件,并将其名称更改为css.css,它不再看到正确的文件。它只看到我在最初设置代码时编写的一行文件。现在我有了一个完整的文件,它仍然使用不再存在的一行程序。如果我改回同一文件夹中的.php文件(两者之间的唯一区别是文件扩展名),一切正常吗?我哪里出错了?我相信这是我看不到的简单的东西

下面是加载css文件的index.html

<!doctype html>
<html lang= "en">
    <head>
        <title>Rogers Enterprises</title>
        <link rel= "icon" type= "image/png" href= "images/bc2.JPG">
        <meta charset="utf-8">
        <link rel="stylesheet" href= "css/css.css" >
        <script src="js/js.js"></script>
    </head>
这是生成CSS的preferences.php

$file = fopen("../css/css.css", "w");
    $txt = 'body { background: linear-gradient(to top right, #ffff00 0%, #000000 100%);
                   color: #ddd8e4; }

            h1 { color: red;
                 text-align: center; }

            div { /*border: 1px solid black; */
                  padding: 1%;
                  float: left; }

            p.content { text-indent: 2%; }
            p.content::first-letter { font-size: 200%;
                                      font-weight: bold;
                                      color: black }

            #logo { width: 98%; }

            .box { width: 10%; }

            #links { width: 100%; }

            #desc { width: 86%; }

            #footer { width: 98%;
                      background-color: #104e01;
                      display: block; 
                      text-align: center; }

            .footer { width: 31.33%; }

            #login {opacity: 0.2; }

            #login-form { max-width: 100%;
                          display: inline-block;
                          margin-left: auto;
                          margin-right: auto;
                          text-align: left; }

            input { border-radius: 5px;
                    max-width: 25vw; }
            img { max-width: 100%;
                  max-height: 100%; }


            /* styles for smart phone */

            @media only screen and (min-width: 302px) and (max-width: 640px) { 

                .box{ position: relative;
                      width: 98%; }         /* desired width */
                .box:before{ content: "";
                             display: block;
                             padding-top: 16.66666666%; } /*What you want the height to be in relation to the width */
                .box-content{ position:  absolute;
                              top: 0;
                              left: 0;
                              bottom: 0;
                              right: 0; }

                #desc { width: 98%; }

            }

            @media only screen and (min-width: 0px) and (max-width: 370px) {

                #remember_me_label { font-size: 4vw; }

            }

            /* styles for tablet */

            @media only screen and (min-width: 768px) and (max-width: 980px) { /* styles for tablet */

            }';
    fwrite($file, $txt);
    fclose($file);
我的目录结构如下所示

rogersproperties |___index.html |___css | |___css.php | |___css.css |___php |___preferences.php 罗杰斯酒店 |___index.html |___css || uuu css.php || uuuu css.css |___php
|___preferences.phpha是否确保清除浏览器缓存?当您查看css.css文件时,它仅仅是一行吗?或者是你期望的数据?我知道这很简单。清除浏览器缓存成功了。非常感谢你。我已经在这里坐了好几个小时试图弄明白这一点。每当进行更改时,给css文件一个新名称可能会有所帮助。这样,浏览器就不会知道它是同一个文件,也不会有缓存。否则,不仅你,你的用户也会遇到同样的问题。试试版本控制。Eugine Joseph。你能给我解释一下版本控制吗? rogersproperties |___index.html |___css | |___css.php | |___css.css |___php |___preferences.php