Parse error: syntax error, unexpected end of file line 43 ( last line)

Parse error: syntax error, unexpected end of file line 43 ( last line)

我对这段代码有疑问。这里有一些 deleted/changed 的东西。我花了无数个小时试图找出我的;或 } 可能会丢失,但运气不好。你能帮帮我吗

<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Корзина");
?><?

if($_REQUEST['otkr'])
{
 Add2BasketByProductID(
  $_REQUEST['otkr'],
  1,
  array(),
  array(
    array("NAME" => "Текст открытки", "CODE" => "TEXT", "VALUE" => $_REQUEST['text_otkr'])
  )
 );
}

if($_REQUEST['pack'])
{
 Add2BasketByProductID(
  $_REQUEST['pack'],
  1,
  array(),
  array()
 );
}

?> <?$APPLICATION->IncludeComponent(
 "infoday:sale.basket.basket",
 "cart",
 Array(
  "COLUMNS_LIST" => array("NAME","PRICE","TYPE","QUANTITY","DELETE","DELAY","WEIGHT","DISCOUNT"),
  "COMPOSITE_FRAME_MODE" => "A",
  "COMPOSITE_FRAME_TYPE" => "AUTO",
  "COUNT_DISCOUNT_4_ALL_QUANTITY" => "Y",
  "GIFT_ID" => "",
  "HIDE_COUPON" => "Y",
  "PATH_TO_ORDER" => "/personal/order/make/",
  "PRICE_VAT_SHOW_VALUE" => "N",
  "QUANTITY_FLOAT" => "N",
  "SET_TITLE" => "Y"
 )
);?> <?if($USER->isAdmin()):?>&nbsp;&nbsp;<br>
 <br><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>

您缺少 endif;最后。

<?if($USER->isAdmin()):?>&nbsp;&nbsp;<br>
<br><?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");?>
<? endif; ?>

你的代码风格很糟糕...你为什么要混合 html 和 php 并结束 php 部分 (?>) 而在下一行开始新的部分 (< ?)

我重新格式化了你的代码并在我的本地主机上测试它没有解析错误:

<?php 
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Корзина");
?>

<?

if($_REQUEST['otkr'])
{
    Add2BasketByProductID(
        $_REQUEST['otkr'],
        1,
        array(),
        array(
                array("NAME" => "Текст открытки", "CODE" => "TEXT", "VALUE" => $_REQUEST['text_otkr'])
        )
    );
}

if($_REQUEST['pack'])
{
    Add2BasketByProductID(
        $_REQUEST['pack'],
        1,
        array(),
        array()
    );
}

?> 

<?php

$APPLICATION->IncludeComponent(
    "infoday:sale.basket.basket",
    "cart",
    array(
        "COLUMNS_LIST" => array("NAME","PRICE","TYPE","QUANTITY","DELETE","DELAY","WEIGHT","DISCOUNT"),
        "COMPOSITE_FRAME_MODE" => "A",
        "COMPOSITE_FRAME_TYPE" => "AUTO",
        "COUNT_DISCOUNT_4_ALL_QUANTITY" => "Y",
        "GIFT_ID" => "",
        "HIDE_COUPON" => "Y",
        "PATH_TO_ORDER" => "/personal/order/make/",
        "PRICE_VAT_SHOW_VALUE" => "N",
        "QUANTITY_FLOAT" => "N",
        "SET_TITLE" => "Y"
    )
);

?> 

<? 

if($USER->isAdmin()) : 
/* doing nothing here ??? */
endif
?>

&nbsp;&nbsp;<br>

<br>
<? 
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");

?>