多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > php開源 > php教程 > Parse Error: syntax error, unexpected $end 錯誤

Parse Error: syntax error, unexpected $end 錯誤

來源:程序員人生   發布時間:2014-02-10 09:20:14 閱讀次數:2687次

也許是不熟悉的php的一些特性吧,不過寫多了,也就慢慢適應將就了,這里就整理一個代碼編寫調試問題,錯誤如下:Parse error: syntax error, unexpected $end in D:xampphtdocsguestBookguestBook.php on line 330

首先看看程序330行,代碼最后一行,這有什么錯誤?google搜,找到了:

In PHP 5, the following error may appears as an error entry in Apache error log or simply displays on PHP web page, even if calling to php scripts with php_info() works perfectly and successfully returns information on PHP configurations:

Parse Error: syntax error, unexpected $end in ….. scripts.php on line …

The error may caused by a missing curly bracket in PHP script coding. Beside, it may also caused by error in PHP coding in class definition, as in PHP, a class definition cannot be broke up and distributed into multiple files, or into multiple PHP blocks, unless the break is within a method declaration.

But more commonly, the error is often caused by the use of Short Open tags in PHP,

To use short open tags, it must be enabled in PHP.INI. Search for short_open_tag in PHP.INI, and change the value to On. The line should look line:

short_open_tag = On

欺我英文不好???看看其它幾條搜索,都沒說到點子上,那就看看英文了,雖不能如數翻譯,大致意思是瞧明白了:

錯誤發生是使用了短標簽,可以在php.ini中設置short_open_tag = On

原來Parse error 提示一般是 語法錯誤,使用了開放的標簽,語句沒有結束 也就是編程基本的一些錯, 比如沒注意 語句結束加 ";" 或者 if(){...} 后面忘了"}" ;<?php...?>忘了"?>"。仔細檢查代碼,果然是一處漏掉了"}",修改程序正常運行,實例:

conn.php

  1. <?php 
  2. /* 
  3.  * PHP100Job v1.0 
  4.  * Programmer : Msn/QQ haowubai@hotmail.com (925939) 
  5.  * www.phpfensi.com Develop a project PHP - MySQL - Apache 
  6.  * Window 2003 - Preferences - PHPeclipse - PHP - Code Templates 
  7.  */ 
  8. $conn = @ mysql_connect("localhost""root""dong"or die("數據庫鏈接錯誤"); 
  9. mysql_select_db("news"$conn); 
  10. mysql_query("set names 'GBK'"); //使用GBK中文編碼; 
  11. function htmtocode($content) { 
  12. $content = str_replace("n""<br>"str_replace(" ""&nbsp;"$content)); 
  13. return $content
  14. //$content=str_replace("'","‘",$content); 
  15.  //htmlspecialchars(); 
  16.  
  17. ?> 
  18. <?php 
  19. /* 
  20.  * PHP100Job v1.0 
  21.  * Programmer : Msn/QQ haowubai@hotmail.com (925939) 
  22.  * www.php100.com Develop a project PHP - MySQL - Apache 
  23.  * Window 2003 - Preferences - PHPeclipse - PHP - Code Templates 
  24.  */ 
  25.  include("conn.php"); 
  26.  include("head.php"); 
  27.   $SQL="SELECT * FROM `message` order by id desc"
  28.   $query=mysql_query($SQL); 
  29.   while($row=mysql_fetch_array($query)){ 
  30. ?> 
  31. <table width=500 border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef"
  32.   <tr bgcolor="#eff3ff"
  33.   <td>標題:<?=$row[title]?> 用戶:<?=$row[user]?></td> 
  34.   </tr> 
  35.   <tr bgColor="#ffffff"
  36.   <td>內容:<? 
  37.  echo htmtocode($row[content]); 
  38.   ?></td> 
  39.   </tr> 
  40. </table> 
  41. <? 
  42.   } 
  43. ?> 

運行出現下邊的錯誤

Parse error: syntax error, unexpected $end in E:wampwwwleave_messagelist.php on line 35

報錯的原因在這里<? } ?> 改成 <?php } ?>

解決辦法:你把標題、內容,用戶那三個改成<?php echo $row['title'];?>這樣的就行了啊。函數就<?php echo htmtocode($row[content]); ?>,這不是主要的,至多只是顯示不出.

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: www.亚洲精品.com| 在线xx| 中文字幕精品在线观看 | 日本aa大片在线播放免费看 | 欲色综合| 精品成人在线视频 | 久久精品区 | 久久精品一区二区三区中文字幕 | 中文字幕2区 | 欧美日韩乱 | 99国产精品欧美久久久久久影院 | 久久91在线 | 日本免费一区视频 | 国产精品久久久久久久久久一区 | 性欧美videos另类hd | 网站视频免费 | 老女人一级全黄肉体毛片 | 亚洲成人一区 | www.久久色 | 日本xxx护士 | 真实男女xx00动态视频120秒 | 国产一区二区三区不卡观 | 伊人情人综合网 | 一区一区三区产品乱码 | 欧美一级全黄 | 欧美一区二区久久精品 | 日韩精品在线一区 | 免费一级毛片在线视频观看 | 一区二区三区欧美在线 | www.91色.com| 亚洲最大成人 | 五月天婷五月天综合网在线 | 欧美日韩综合 | 欧美成人黑人xx视频免费观看 | 一区二区三区鲁丝不卡麻豆 | 性欧美成人免费观看视 | 国产精品嫩草影院在线 | 视频网18免费 | 国产福利视频一区二区三区 | 免费在线h视频 | 亚洲欧美综合乱码精品成人网 |