仍在查看代码,但找不到错误。也许我有点失明也许我应该休息一下但是在休息之前试着完成这个。 最后一行给出错误。 “解析错误:语法错误,第274行的...... / index.php中的意外$结尾” 对此有何解决方案或建议?
<?php
include("config.php");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
$query = mysql_query("select * from settings");
while($print = mysql_fetch_array($query)){ ?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="<?php echo $print['description']; ?>" />
<meta name="keywords" content="<?php echo $print['keywords']; ?>" />
<meta name="author" content="-, -" />
<title><?php echo $print['title']; ?></title>
<link rel="stylesheet" type="text/css" href="thema/default/main.css" />
<script type="text/javascript" src="thema/default/javascript/cycle.js"></script>
<script type="text/javascript" src="ajax/api.js"></script>
<!--[if IE]>
<style type="text/css">
.header_category_item{
padding:11px 14px 9px 14px !important;
}
</style>
<![endif]-->
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script src="js/jquery.blueberry.js"></script>
<script>$(window).load(function() { $('.blueberry').blueberry(); }); </script>
<script type="text/javascript">
$(document).ready(function() {
$(".ajaxLoad").hide();
$('.home_video').cycle({
fx: 'scrollHorz',
speed: 500, //Geçiş süreci
timeout: 5000,//Geçiş Süresi
pauseOnPagerHover: true,
prev: '.homve_video_prev',
next: '.homve_video_next',
pause: true,
});
$('.home_photo').cycle({
fx: 'scrollHorz',
speed: 500, //Geçiş süreci
timeout: 5000,//Geçiş Süresi
pauseOnPagerHover: true,
prev: '.homve_photo_prev',
next: '.homve_photo_next',
pause: true,
});
$('.last_min').cycle({
fx: 'scrollVert',
speed: 100, //Geçiş süreci
timeout: 5000,//Geçiş Süresi
pauseOnPagerHover: true,
prev: '.last_min_prev',
next: '.last_min_next',
pause: true,
});
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#basadon").css("display","none");
$(window).scroll(function () {
var top = $(this).scrollTop();
if (top > 50) {
$("#basadon").fadeIn("normal");
}else {
$("#basadon").fadeOut("fast");
}
});
$("#basadon").click(function(){
$('body').animate( { scrollTop: 0 }, 'normal' );
});
});
</script>
</head>
<body>
<div class="page">
<!-- Header -->
<div class="ajaxLoad"><img src="thema/default/images/loading51.gif"></div>
<div style="position:fixed; margin-left:-166px; margin-top:-5px; width:160px; overflow:hidden;">
</div>
<div style="position:fixed; margin-left:997px; margin-top:-5px; width:160px; overflow:hidden;">
</div>
<div style="height:35px; margin-bottom:5px; margin-top:-5px; font-weight:bold; color:#036; background-color:#F0F0F0; font-size:12px;">
<div class="header_general_menu_item"><a href="index<?php echo $print['seourl']; ?>">Anasayfa</a></div>
<?php $ggg = mysql_query("select * from pages order by sira asc"); while($hhh = mysql_fetch_array($ggg)){ if($print['seourl']==".php"){ ?>
<div class="header_general_menu_item"><a href="pages.php?url=<?php echo $hhh['sefurl']; ?>"><?php echo $hhh['baslik']; ?></a></div>
<?php }elseif($print['seourl']==".html"){ ?>
<div class="header_general_menu_item"><a href="sayfa-<?php echo $hhh['sefurl']; ?>.html"><?php echo $hhh['baslik']; ?></a></div>
<div class="header_general_menu_item" style="float:right; padding:2px;"><form action="http://www.ersoyotomotiv.org/search.php" method="get">
<input style="margin-top:2px; margin-right:3px; border:#EAEAEA 1px solid; height:22px; padding:3px; width:240px; font-style:italic; color:#999" type="text" name="s" value="Haber Ara" onFocus="if(this.value=='Haber Ara')this.value='';" onBlur="if(this.value=='')this.value='Haber Ara';"/><input type="submit" value=" Ara " style="width:50px; height:27px; margin-top:-1px; border:0px; background-color:#C00; color:#FFF; font-weight:bold; font-size:11px;" /></form></div>
</div>
<div class="logo"><a href="index<?php echo $print['seourl']; ?>"><img src="images/logo.png" alt="<?php echo $print['title']; ?>" width="247" height="90" border="0" /></a></div>
<div class="header_advert">
<script async src="../pagead2.googlesyndication.com/pagead/js/f.txt"></script>
<!-- En üstteki Reklam -->
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1212664113367830"
data-ad-slot="8895001303"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
<div class="clear"></div>
<div class="header_top_menu"></div>
<div class="header_category">
<div class="mask">
<?php if($print['seourl']==".php"){ $ccc = mysql_query("select * from emkat where kategori='' order by sira asc"); while($ddd = mysql_fetch_array($ccc)){ $urx = $ddd['sefurl']; ?>
<div class="header_category_item"><a href="emkat.php?url=<?php echo $ddd['sefurl']; ?>">><?php echo $ddd['baslik']; ?></a></div>
<?php $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>
<div class="header_category_item"><a href="emkat.php?url=<?php echo $ddx['sefurl']; ?>"><?php echo $ddx['baslik']; ?></a></div>
<?php } ?></li><?php } }elseif($print['seourl']==".html"){ $ccc = mysql_query("select * from emkat where kategori='' order by sira asc"); while($ddd = mysql_fetch_array($ccc)){ $urx = $ddd['sefurl']; ?>
<div class="header_category_item"><a href="kategori-<?php echo $ddd['sefurl']; ?>.html"><?php echo $ddd['baslik']; ?></a></div>
<?php $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>
<div class="header_category_item"><a href="kategori-<?php echo $ddx['sefurl']; ?>.html"><?php echo $ddx['baslik']; ?></a></div>
<?php } ?>
</div>
<div class="clear"></div>
</div>
<!-- End Header -->
<div>
<!-- Content -->
<div class="news_boxs">
<?php if($print['seourl']==".php"){ ?>
<div class="php_news_box" style="margin:10px 20px; position:relative"><a href="emlakdetail.php?url=<?php echo $fff['sefurl']; ?>"><img src="<?php echo $fff['thumb']; ?>" alt="<?php echo $fff['baslik']; ?>" width="227" height="157" title="<?php echo $fff['baslik']; ?>" /></a><br>
<?php }elseif($print['seourl']==".html"){ ?>
<a href="emlak-<?php echo $fff['sefurl']; ?>.html"><img src="<?php echo $fff['thumb']; ?>" alt="<?php echo $fff['baslik']; ?>" width="227" height="157" title="<?php echo $fff['baslik']; ?>" /></a><br>
<?php } ?>
<table width="100%" class="detail_home" border="0" cellspacing="0" cellpadding="0">
<?php $asd1 = mysql_query("select * from emkat where sefurl='".$fff['anakat']."'"); while($asd2 = mysql_fetch_array($asd1)){ echo $asd2['baslik']; } echo ' ';
$asd3 = mysql_query("select * from emkat where sefurl='".$fff['altkat']."'"); while($asd4 = mysql_fetch_array($asd3)){ echo $asd4['baslik']; } ?><br>
<p><?php echo $fff['il']; ?> / <?php echo $fff['ilce']; ?></p><?php } ?>
<tr>
<td width="27%"><strong>Fiyat</strong></td>
<td width="2%"><strong>:</strong></td>
<td width="71%"><?php echo number_format($fff['fiyat']); ?> TL</td>
</tr>
<tr>
<td><strong><?php if($print['seourl']==".php"){ ?>
<a href="emlakdetail.php?url=<?php echo $fff['sefurl']; ?>">Ayrıntılar</a>
<?php }elseif($print['seourl']==".html"){ ?>
<a href="emlak-<?php echo $fff['sefurl']; ?>.html">Ayrıntılar</a>
<?php } ?></strong></td>
</tr>
</table>
</div>
<div class="clear"></div>
</div><!-- Content -->
</div>
<!-- Footer -->
<div style="clear:both"></div>
<div style="height:35px; margin-bottom:5px; margin-top:0px; font-weight:bold; color:#036; background-color:#F0F0F0; font-size:12px;">
</div>
<div style="clear:both"></div>
<div style="margin-top:10px; background-repeat: no-repeat; border-top: #EAEAEA 2px dotted;">
<div style="float:left; width:220px; height:80px;">
<a href="index<?php echo $print['seourl']; ?>"><img src="images/logo.png" alt="<?php echo $print['title']; ?>" width="220" height="80" border="0" /></a>
</div>
<div style="padding:35px; font-size:11px;">
<strong>©</strong> Copyright <?php echo date('Y'); ?>, <strong><?php echo $print['title']; ?> </strong>. Tüm hakları saklıdır. </div>
<div style="clear:both"></div>
</div>
<div onclick="" id="basadon" style="position: fixed; right:10px; bottom:10px; width:50px; height:50px; background-image:url(thema/default/images/top_ico.png); background-repeat:no-repeat;">
</div>
<!-- End Footer -->
</div>
<script> function SayiKontrol(e) {
olay = document.all ? window.event : e;
tus = document.all ? olay.keyCode : olay.which;
if(tus<48||tus>57) {
if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
}
} </script>
</body>
</html>
<?php } ?>
答案 0 :(得分:0)
您的代码不均衡。如果删除除PHP之外的所有内容,则删除除第一个和最后一个之外的每对<?php
?>
,然后格式化代码,这就是结果:
<?php
include("config.php");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
$query = mysql_query("select * from settings");
while ($print = mysql_fetch_array($query)) {
echo $print['description'];
echo $print['keywords'];
echo $print['title'];
echo $print['seourl'];
$ggg = mysql_query("select * from pages order by sira asc");
while ($hhh = mysql_fetch_array($ggg)) {
if ($print['seourl']==".php") {
echo $hhh['sefurl'];
echo $hhh['baslik'];
}
elseif ($print['seourl']==".html") {
echo $hhh['sefurl'];
echo $hhh['baslik'];
echo $print['seourl'];
if ($print['seourl']==".php") {
$ccc = mysql_query("select * from emkat where kategori='' order by sira asc");
while ($ddd = mysql_fetch_array($ccc)) {
$urx = $ddd['sefurl'];
echo $ddd['sefurl'];
echo $ddd['baslik'];
$ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc");
while ($ddx = mysql_fetch_array($ccx)) {
echo $ddx['sefurl'];
echo $ddx['baslik'];
}
}
}
elseif ($print['seourl']==".html") {
$ccc = mysql_query("select * from emkat where kategori='' order by sira asc");
while ($ddd = mysql_fetch_array($ccc)) {
$urx = $ddd['sefurl'];
echo $ddd['sefurl'];
echo $ddd['baslik'];
$ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc");
while ($ddx = mysql_fetch_array($ccx)) {
echo $ddx['sefurl'];
echo $ddx['baslik'];
}
if ($print['seourl']==".php") {
echo $fff['sefurl'];
echo $fff['thumb'];
echo $fff['baslik'];
echo $fff['baslik'];
}
elseif ($print['seourl']==".html") {
echo $fff['sefurl'];
echo $fff['thumb'];
echo $fff['baslik'];
echo $fff['baslik'];
}
$asd1 = mysql_query("select * from emkat where sefurl='".$fff['anakat']."'");
while ($asd2 = mysql_fetch_array($asd1)) {
echo $asd2['baslik'];
}
echo ' ';
$asd3 = mysql_query("select * from emkat where sefurl='".$fff['altkat']."'");
while ($asd4 = mysql_fetch_array($asd3)) {
echo $asd4['baslik'];
}
echo $fff['il'];
echo $fff['ilce'];
}
echo number_format($fff['fiyat']);
if ($print['seourl']==".php") {
echo $fff['sefurl'];
}
elseif ($print['seourl']==".html") {
echo $fff['sefurl'];
}
echo $print['seourl'];
echo $print['title'];
echo date('Y');
echo $print['title'];
}
?>
我想一个解决方案是添加剩余的三个}
,但您可能需要自己查看逻辑以确定
下面是我对三个结束大括号所属位置的最佳猜测。请记住,我不知道您的数据库是什么样的,我没有运行代码:
<?php
include("config.php");
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_bin'");
$query = mysql_query("select * from settings");
while ($print = mysql_fetch_array($query)) {
echo $print['description'];
echo $print['keywords'];
echo $print['title'];
echo $print['seourl'];
} // ADDED THIS CLOSING CURLY
$ggg = mysql_query("select * from pages order by sira asc");
while ($hhh = mysql_fetch_array($ggg)) {
if ($print['seourl']==".php") {
echo $hhh['sefurl'];
echo $hhh['baslik'];
}
elseif ($print['seourl']==".html") {
echo $hhh['sefurl'];
echo $hhh['baslik'];
echo $print['seourl'];
if ($print['seourl']==".php") {
$ccc = mysql_query("select * from emkat where kategori='' order by sira asc");
while ($ddd = mysql_fetch_array($ccc)) {
$urx = $ddd['sefurl'];
echo $ddd['sefurl'];
echo $ddd['baslik'];
} // ADDED THIS CLOSING CURLY
$ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc");
while ($ddx = mysql_fetch_array($ccx)) {
echo $ddx['sefurl'];
echo $ddx['baslik'];
}
}
}
elseif ($print['seourl']==".html") {
$ccc = mysql_query("select * from emkat where kategori='' order by sira asc");
while ($ddd = mysql_fetch_array($ccc)) {
$urx = $ddd['sefurl'];
echo $ddd['sefurl'];
echo $ddd['baslik'];
} // ADDED THIS CLOSING CURLY
$ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc");
while ($ddx = mysql_fetch_array($ccx)) {
echo $ddx['sefurl'];
echo $ddx['baslik'];
}
if ($print['seourl']==".php") {
echo $fff['sefurl'];
echo $fff['thumb'];
echo $fff['baslik'];
echo $fff['baslik'];
}
elseif ($print['seourl']==".html") {
echo $fff['sefurl'];
echo $fff['thumb'];
echo $fff['baslik'];
echo $fff['baslik'];
}
$asd1 = mysql_query("select * from emkat where sefurl='".$fff['anakat']."'");
while ($asd2 = mysql_fetch_array($asd1)) {
echo $asd2['baslik'];
}
echo ' ';
$asd3 = mysql_query("select * from emkat where sefurl='".$fff['altkat']."'");
while ($asd4 = mysql_fetch_array($asd3)) {
echo $asd4['baslik'];
}
echo $fff['il'];
echo $fff['ilce'];
}
echo number_format($fff['fiyat']);
if ($print['seourl']==".php") {
echo $fff['sefurl'];
}
elseif ($print['seourl']==".html") {
echo $fff['sefurl'];
}
echo $print['seourl'];
echo $print['title'];
echo date('Y');
echo $print['title'];
}
?>
三个右括号对应于您发布的代码中的这些行:
<强> 1 强>:
<?php $ggg = mysql_query("select * from pages order by sira asc"); while($hhh = mysql_fetch_array($ggg)){ if($print['seourl']==".php"){ ?>
变为:
<?php } $ggg = mysql_query("select * from pages order by sira asc"); while($hhh = mysql_fetch_array($ggg)){ if($print['seourl']==".php"){ ?>
<强> 2 强>
<?php $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>
变为:
<?php } $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>
3 (另一个,语法与2相同):
<?php $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>
变为:
<?php } $ccx = mysql_query("select * from emkat where kategori='$urx' order by sira asc"); while($ddx = mysql_fetch_array($ccx)){ ?>