2017-01-02 76 views
-1

環境Apache不加載正確的文件

Host - Windows 10 
Browser - GoogleChrome (Caching is disabled) 
IDE - Intelij IDEA 

Oracle VirtualBox with CentOS 7 
Apache Server 
PHP Version 5.6.29 
PHP Composer 

問題

我有我的系統一個非常令人沮喪的行爲。

如果我開始我的VirtualBox和Apache,網站correkt顯示,但如果我在HTML改變的東西它沒有加載到瀏覽器中,但在共享文件夾是正確的。

Screen from IDE IDEA

Code in the Shared folder

Loaded file from the browser

但是如果刪除按鈕時,它被示出正確(無按鈕)。如果我再次添加該按鈕,則在另一個位置上,該按鈕將顯示在帶有舊標籤的舊位置。

是否有人可以解釋這種行爲,或有有關此問題的一些訣竅? 我不知道哪個組件觸發了這種行爲。

------- UPDATE 1 ---------

login.html文件是在UTF8

有一件事我IST以前沒有見過,這條線在瀏覽器中編輯器(開發者模式)。

enter image description here

----------- UPDATE 2 -----------

我添加此更新創造更好的說明問題。

這是原來的HTML

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <title>Title</title> 
</head> 
<body> 
<h1>Login</h1> 
<form method="POST" action="../controller/login.php"> 
    <input id="txtUsername" type="text" placeholder="username"/> 
    <input id="txtPassword" type="password" placeholder="password"/> 
    <input id="btnSubmit" type="submit"/> 
</form> 
</body> 
</html> 

Output of the original HTML Code

如果我將提交按鈕的頂部,或者改變原有的密碼,並點擊CTRLF5,沒有什麼變化。只有在瀏覽器開發商編輯器出現紅點(如果我懸停在一個點,我得到的提示\u0

<h1>Login</h1> 
<form method="POST" action="../controller/login.php"> 
    <input id="btnSubmit" type="submit"/> 
    <input id="txtUsername" type="text" placeholder="username"/> 
    <input id="txtPassword" type="password" placeholder="password"/> 
</form> 

enter image description here

下面的幻燈片,在源文件夾中的服務器上文件已更改正確。

enter image description here

+0

也許緩存問題?嘗試刷新頁面CTRL + F5 – Hokusai

+0

不,我試過了。如果我在'html'中改變了某些東西,我可以看到,有些東西改變了,但是錯誤的東西。如果我添加一個''我可以看到它們。如果我將它移動兩行......我有3個「文本字段」,但沒有「按鈕」。現在我嘗試使用'',這個工作,但是...爲什麼我不能使用按鈕標籤。在http://caniuse.com/#search=button我可以看到,按鈕標籤應該能夠在我的瀏覽器中使用(Chrom 55.0.2883.87米)。 。 –

+0

聽起來不像是一個PHP問題。什麼是正確的行爲,你能展示正確的顯示和代碼嗎?您還應該將實際的代碼添加到問題中。用戶不想抄錄.. – chris85

回答

0

嗯,這個問題的原因很簡單。 Windows中的CRLF不是像CentOS的一樣,有它是一個LF。

另一個需要一點時間的問題是,CRLF無法在我的IDE或我使用的其他工具中讀取。

隨着dos2unix我可以修復它。