簡體   English   中英

將視口標簽添加到header.php會導致php錯誤

[英]Adding viewport tag to header.php causes php error

我正在使用一個包含文件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

感謝您的幫助!

您沒有在此處轉義雙引號

<?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>";
?>

使用單引號

<?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>";
?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM