2013-07-24 71 views
0

我正在使用一個php腳本,它具有一個帶有普通網頁頁眉信息的文件header.php。但是,當我添加視口標籤時,會引發錯誤。將視口標籤添加到header.php會導致php錯誤

的header.php:

<?php 
/* 
UserCake Version: 2.0.2 
http://usercake.com 
*/ 
echo " 
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> 
<html xmlns='http://www.w3.org/1999/xhtml'> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> 
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> 
<title>".$websiteName."</title> 
<link href='".$template."' rel='stylesheet' type='text/css' /> 
<script src='models/funcs.js' type='text/javascript'> 
</script> 
</head>"; 

?> 

返回錯誤:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/30/d332080598/htdocs/azotusorg/usercake/models/header.php on line 10 

感謝有這方面的幫助!

回答

0

你是不是逃避雙重這裏

報價
<?php 
echo " 
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> 
<html xmlns='http://www.w3.org/1999/xhtml'> 
<head> 
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/> 
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> 
<title>".$websiteName."</title> 
<link href='".$template."' rel='stylesheet' type='text/css' /> 
<script src='models/funcs.js' type='text/javascript'> 
</script> 
</head>"; 
?> 

OR使用單引號

<?php 
echo " 
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> 
<html xmlns='http://www.w3.org/1999/xhtml'> 
<head> 
<meta name='viewport' content='width=device-width, initial-scale=1.0'/> 
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> 
<title>".$websiteName."</title> 
<link href='".$template."' rel='stylesheet' type='text/css' /> 
<script src='models/funcs.js' type='text/javascript'> 
</script> 
</head>"; 
?> 
+1

謝謝約傑什! – user1218172

相關問題