2014-03-24 20 views
0

Removing empty lines in Notepad++卸下空行的記事本++導致T_VARIABLE語法錯誤

如上你能夠與記事本中刪除空行++在線程描述。我確實嘗試了這些方法,但我總是收到奇怪的T_Variable語法錯誤(大部分在第1-6行)。這些線路絕對沒有錯誤,我在任何地方都看不到。

當我手動刪除代碼某些區域中的空行(例如前5行)時,也會發生這種情況。我猜這是一個編碼問題,但也用UTF-8重新編碼,Ascii等沒有幫助。

這些行是我在幾個月前使用webhoster的在線編輯器時添加的(前面的行之間有1條空行)。

我不明白,也許你會這樣(預先感謝!)。該文件是在http://lightningsoul.com/index.php

這裏是第一個代碼塊:

<?php 

include("db/lg_db_login.php"); 
//require 'fb/facebook.php'; 
if (isset($_GET['c'])) { $content = $_GET['c']; } 
else { $content = ""; } 
if (isset($_GET['sc'])) { $subcontent = $_GET['sc']; } 
else { $subcontent = ""; } 
if (isset($_GET['setlang'])) { $setlang = $_GET['setlang']; } 
else { $setlang = "eng"; } 
$cat = $_GET['cat']; 

// Check if Lightningsoul.de or .com 
$findme = '.de'; 
$posde = strpos($thisurl, $findme); 

// Note our use of ===. Simply == would not work as expected 
// because the position of 'a' was the 0th (first) character. 
if ($posde === false) { 
    $lang = "en"; 
} else { 
    $lang = "de"; 
} 
include("db/pageturn_class.php"); 

$findStr = '/lightningsoulcom'; 
$isApp = strpos($thisurl, $findStr); 

// Beachten Sie die Verwendung von ===. Ein einfacher Vergleich (==) liefert 
// nicht das erwartete Ergebnis, da die Position von 'a' die nullte Stelle 
// (also das erste Zeichen) ist 
/*if ($isApp == false) { 
    $getStyle = "css/get_style.php"; 
} else { 
    $getStyle = "css/get_style_small.php"; 
} */ 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Code looks like this

+1

首先,你爲什麼要刪除空行?在你的代碼部分?如果是'',則不需要。刪除空行是有用的(相對...)讓你的html輸出更輕。 php部分永遠不會呈現在HTML上,如果有emply行,它並不重要,它對開發人員來說更容易閱讀。 –

+0

除了上面的建議。 「不要刪除空行,你的代碼的可讀性是首要任務!」你檢查過修改過的文件嗎?它是什麼樣子的? – ToBe

+0

http://lightningsoul.com/private/img/empty_lines.png因爲代碼看起來像這樣。在使代碼可讀的正常空行之間有另一條空行。也許你應該閱讀我在原文中寫過的內容? – Lightningsoul

回答

0

的問題是在東西(記事本++?)一定改變導線181

<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 

<meta http-equiv="content-type" content="text/html; charset=Windows-1250" /> 

正如人們所期望的那樣產生了很多錯誤。我只是通過部分去除頭部來找到它。

相關問題