本地主机上出现奇怪的404错误

时间:2014-08-28 00:49:48

标签: javascript php html mysql

所以我有一个mySQL数据库,我把它连接到一些php和html文件。我的php文件在localhost文件夹中。当我运行我的测试html文件也在我的localhost文件夹中时,它没有问题找到该文件,但是当我在我的localhost文件夹中有一个子文件夹名为" SriMeru"我有我的实际html文件与格式和其他东西以及最终的PHP文件,HTML文件无法找到PHP文件。这是html文件中的一些代码:

<div id="mmargin" style="background-color:#F1ECDF;height:810px;width:600px;float:left;">
      <p id = "myDiv">no</p>
   <script>
       function loadPHPDoc(str){
       var xmlhttp;
       if (window.XMLHttpRequest)
         {// code for IE7+, Firefox, Chrome, Opera, Safari
         xmlhttp=new XMLHttpRequest();
         }
       else
         {// code for IE6, IE5
         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
       xmlhttp.onreadystatechange=function()
         {
         if (xmlhttp.readyState==4 && xmlhttp.status==200)
           {
           document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
           }
         else{
           document.getElementById("myDiv").innerHTML="failure";
         }
         }
       xmlhttp.open("POST","srimeru/forumSubmit.php",true);
       xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
       var sender = "q=" + str;
       xmlhttp.send(sender);
       }

   </script>

      <p>
     Message <input type= "text" id="messbox">
     <button type= "button" onclick="loadPHPDoc(document.getElementById('messbox').value)">input</button>
      </p>
</div>

这是我的php文件代码:

<?php

    $q = $_POST["q"];

    $messData = mysqli_connect("localhost", "root", "chendu", "SriMeru");
    if (mysqli_connect_errno()){
        echo "Failed to connect to Server";
    }
    $sql = "INSERT INTO messages VALUES ('".$q."')";
    mysqli_query($messData, $sql);
    echo "<p>success</p>";

   mysqli_close($messData);
?>

html文件中的其他地方,我有一些涉及选框和计时器的奇怪格式,我不知道这是否会搞砸。

1 个答案:

答案 0 :(得分:2)

  

&#34;但是当我在localhost文件夹中有一个名为&#34; SriMeru&#34; 的子文件夹,其中我有我的实际html文件&#34;

您说您的文件夹名为SriMeru

在许多系统(包括UNIX / LINUX)上,SriMerusrimeru不是一回事;它们区分大小写。

因此,要么将文件夹全部重命名为小写字母,要么将srimeru/forumSubmit.php更改为SriMeru/forumSubmit.php

相关问题