我无法在我的php文件中找到错误

我无法在我的php文件中找到错误,php,syntax,Php,Syntax,朋友们好,我在php方面没有太多技能。请帮我输入这个代码。它正在显示语法错误文件的意外结尾。我试过了,但没通过。当我从文件中删除此代码时,页面显示正确,但粘贴此代码时,再次显示相同的错误 文件中只有此代码,因此可能存在括号、句号或其他问题。请更正此代码,并在回答中给出固定代码。我爱你们你们真的在帮助那些需要帮助的人 <?php include("include/header.php"); if (!isset($_SESSION["userlogin"])) { header("l

朋友们好,我在php方面没有太多技能。请帮我输入这个代码。它正在显示语法错误文件的意外结尾。我试过了,但没通过。当我从文件中删除此代码时,页面显示正确,但粘贴此代码时,再次显示相同的错误

文件中只有此代码,因此可能存在括号、句号或其他问题。请更正此代码,并在回答中给出固定代码。我爱你们你们真的在帮助那些需要帮助的人

<?php
include("include/header.php");
if (!isset($_SESSION["userlogin"])) {
    header("location: login.php");
    exit();
}
$edit = dbFetchArray(dbQuery("select * from `user_registration` where `email`='" . $_SESSION["userlogin"] . "'"), MYSQL_BOTH);
$Id = base64_decode($_REQUEST['Id']);
$up = mysql_fetch_array(mysql_query("select * from `jobs` where `id`='" . $Id . "'"));
$status = stripslashes($up["highlighted"]);
$name = stripslashes($up["title"]);
$explode = explode(" ", $name);
$tit = isset($explode[0]) ? $explode[0] : '';
$col = isset($explode[1]) ? $explode[1] : '';
$cat = isset($explode[2]) ? $explode[2] : '';

$user = mysql_fetch_array(mysql_query("select * from `user_registration` where `email`='" . $_SESSION["userlogin"] . "'"));
$fullname = stripslashes($user['fullname']);
$customer_id = $user['id'];
$current_balence = $user['current_balance'];

if (isset($_POST["Button"])) {
    if (isset($_REQUEST["Available_positions"])) {
        $Available_positions = $_POST["Available_positions"];
        if (strpos($Available_positions, '.') === false) {
            $pos = $Available_positions;
            $pos1 = 0;
        } else {
            $pieces = explode(".", $Available_positions);
            $pos = $pieces[0];
            $pos1 = $pieces[1];
        }

        $Payment_per_task = $_POST["Payment_per_task"];

        $hid = $_REQUEST['hid'];
        if ($pos1 > 0) {
            ?>
            <script>
                alert('Job Posting Suspended');
                window.location.href="edit_job.php?Id=<?= base64_decode($hid) ?>";
            </script>
            <?
        } else {
            dbQuery("update `jobs` set `wd2`='" . $Available_positions . "',`price`='" . $Payment_per_task . "' where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'");
            ?>
            <script>
                window.location.href="employer.php";
            </script>
            <?
        }
    }
    $_SESSION['hid'] = $hid;
    if ($hid > 0) {
        $_SESSION["success"] = '';
    } else {
        $_SESSION["error"] = '';
    }
} else if (isset($_POST["Cancel"])) {
    $hid = $_REQUEST['hid'];
    dbQuery("update `jobs` set `status`='3' where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'");
    $resJ = dbFetchArray(dbQuery("select * from `jobs` where `id`='" . $hid . "' and `email`='" . $_SESSION["userlogin"] . "'"), MYSQL_BOTH);

    if ($resJ["wd1"] != $resJ["wd2"]) {
        $CJ = $resJ["wd2"] - $resJ["wd1"];
        $CJFees = $CJ * $resJ["price"];
        dbQuery("insert into `myaccount`(`email`,`amount`,`type`,`createdate`,`jobid`) values('" . $_SESSION['userlogin'] . "','$CJFees','10',NOW(),'" . $resJ["id"] . "')");
        $rescurbal = dbFetchArray(dbQuery("select * from `user_registration` where `email`='" . $_SESSION['userlogin'] . "'"), MYSQL_BOTH);
        dbQuery("update `user_registration` set `current_balance`='" . ($rescurbal["current_balance"] + $CJFees) . "' where `email`='" . $_SESSION['userlogin'] . "'");
    }
    ?>
    <script>
        window.location.href="employer.php";
    </script>
    <?
}
?>

如果没有激活的短标记,则必须使用
。因此,将缺少括号,因此会出现语法错误,就像您得到的语法错误一样。

逐个剪切大块代码并刷新页面。如果需要检查脚本是否在不产生错误的情况下执行到某一点,可以使用函数停止进一步的脚本执行


当错误消失时,这意味着它在您刚刚剪切的块中。然后一行一行地重复这个过程,这样你就能找到错误。这可能是括号、引号、分号或类似的语法错误。

此外,请确保您的文件编码为UTF-8,没有BOM表。
include ("include/header.php");
if(!isset($_SESSION["userlogin"]))
{
    header("location: login.php");
    exit();
}
$edit = dbFetchArray(dbQuery("select * from `user_registration` where `email`='".$_SESSION["userlogin"]."'"),MYSQL_BOTH);
$Id = base64_decode($_REQUEST['Id']);
$up = mysql_fetch_array(mysql_query("select * from `jobs` where `id`='".$Id."'"));
$status = stripslashes($up["highlighted"]);
$name = stripslashes($up["title"]);
$explode = explode(" ",$name);
$tit = isset($explode[0]) ? $explode[0] : '';
$col = isset($explode[1]) ? $explode[1] : '';
$cat = isset($explode[2]) ? $explode[2] : '';

$user = mysql_fetch_array(mysql_query("select * from `user_registration` where `email`='".$_SESSION["userlogin"]."'"));
$fullname = stripslashes($user['fullname']);
$customer_id = $user['id'];
$current_balence = $user['current_balance'];

if(isset($_POST["Button"]))
{
    if(isset($_REQUEST["Available_positions"]))
    {
        $Available_positions = $_POST["Available_positions"];
        if(strpos($Available_positions,'.') === false)
        {
            $pos = $Available_positions;
            $pos1 = 0;
        }
        else
        {
            $pieces = explode(".",$Available_positions);
            $pos = $pieces[0];
            $pos1 = $pieces[1];
        }

        $Payment_per_task = $_POST["Payment_per_task"];

        $hid = $_REQUEST['hid'];
        if($pos1 > 0)
        {

?>
<script>
alert('Job Posting Suspended');
window.location.href="edit_job.php?Id=<?= base64_decode($hid)?>";
</script>
<?

        }
        else
        {
            dbQuery("update `jobs` set `wd2`='".$Available_positions."',`price`='".$Payment_per_task."' where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'");

?>
 <script>
window.location.href="employer.php";
</script>
<?

        }
    }
    $_SESSION['hid'] = $hid;
    if($hid > 0)
    {
        $_SESSION["success"] = '';
    }
    else
    {
        $_SESSION["error"] = '';
    }
}
else
{
    if(isset($_POST["Cancel"]))
    {
        $hid = $_REQUEST['hid'];
        dbQuery("update `jobs` set `status`='3' where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'");
        $resJ = dbFetchArray(dbQuery("select * from `jobs` where `id`='".$hid."' and `email`='".$_SESSION["userlogin"]."'"),MYSQL_BOTH);

        if($resJ["wd1"] != $resJ["wd2"])
        {
            $CJ = $resJ["wd2"] - $resJ["wd1"];
            $CJFees = $CJ * $resJ["price"];
            dbQuery("insert into `myaccount`(`email`,`amount`,`type`,`createdate`,`jobid`) values('".$_SESSION['userlogin']."','$CJFees','10',NOW(),'".$resJ["id"]."')");
            $rescurbal = dbFetchArray(dbQuery("select * from `user_registration` where `email`='".$_SESSION['userlogin']."'"),MYSQL_BOTH);
            dbQuery("update `user_registration` set `current_balance`='".($rescurbal["current_balance"] + $CJFees)."' where `email`='".$_SESSION['userlogin']."'");
        }

?>
<script>
window.location.href="employer.php";
</script>
<?
    }
}
include(“include/header.php”);
如果(!isset($\u会话[“userlogin”]))
{
标题(“location:login.php”);
退出();
}
$edit=dbFetchArray(dbQuery(“从'user\u registration'中选择*,其中'email`='”$\u SESSION[“userlogin”]。“””),MYSQL\u二者皆有);
$Id=base64_解码($_请求['Id']);
$up=mysql\u-fetch\u数组(mysql\u查询(“从'jobs'中选择*,其中'id`='”。$id.“”));
$status=stripslashes($up[“突出显示”]);
$name=stripslashes($up[“title”]);
$explode=explode(“,$name”);
$tit=isset($explode[0])$爆炸[0]:“”;
$col=isset($explode[1])$爆炸[1]:'';
$cat=isset($explode[2])$爆炸[2]:'';
$user=mysql\u fetch\u数组(mysql\u查询(“从`user\u registration`中选择*,其中`email`='”。$\u会话[“userlogin”]。”));
$fullname=stripslashes($user['fullname']);
$customer_id=$user['id'];
$current_balence=$user['current_balence'];
如果(isset($_POST[“按钮]))
{
如果(isset($_请求[“可用位置]))
{
$Available_positions=$_POST[“Available_positions”];
if(strpos($Available_positions,'.')==false)
{
$pos=$可用位置;
$pos1=0;
}
其他的
{
$pieces=爆炸(“.”,$Available_positions);
$pos=$pieces[0];
$pos1=$pieces[1];
}
$Payment_per_task=$_POST[“Payment_per_task”];
$hid=$_请求['hid'];
如果($pos1>0)
{
?>
警报(“暂停发布职务”);
window.location.href=“edit_job.php?Id=”;

行?您尝试了什么?错误消息?base64_解码缺少分号标头错误。php@AliMohammadi
它显示的是问题中的语法错误意外的文件结尾
try Include\u一旦安装Include.base64\u再次解码丢失分号这不完全正确,它取决于php.ini配置。它通常是enough、 @HankyPankyㇱ 第一个没问题,第二个不需要分号。php函数调用怎么可能不需要这样的分号呢?@考虑一下默认配置是必需的,然后查看错误(意外的文件结尾)我想问题是这样的。
当我从文件中删除此代码时,页面显示正确,但当我粘贴此代码时,它显示相同的错误。
他已经在使用此代码了technique@Ejay不,他不是在使用这种技术,他是在剪切整个文本,然后再尝试。--扎夫格说,把它一块一块地拿出来,这是一个很好的方法好的建议,不应该被否决。@Ejay你没有仔细阅读我的建议answer@Twisted1919谢谢你的支持:)@Ejay我一直认为社区不应该搜索某人代码中的语法错误,而是应该分享如何处理常见问题的更宝贵经验。谢谢朋友,它没有帮助我,你可以请求吗详细说明。。。