如何使用goto语句解码php代码?

时间:2018-12-14 11:27:53

标签: php decode

我有几个大文件,如下所示:

public function index()
{
    goto E9e2246508a1d047;
    b59f99a7185ea4f4:
    return View("\x65\155\160\154\x6f\171\x65\162\56\x74\x72\x61\156\163\141\x63\x74\x69\x6f\156\x73", ["\x70\x61\147\x65" => $F44ac1942f77c961]);
    goto b4ef380f386bfff0;
    E021694d1d524d6a:
    $F44ac1942f77c961 = $C52f2627c8748472->lastpage();
    goto b59f99a7185ea4f4;
    E9e2246508a1d047:
    $C52f2627c8748472 = UserTransaction::where("\165\x73\145\162\x5f\x69\x64", Auth::id())->orderBy("\143\x72\x65\141\164\x65\x64\x5f\141\x74", "\x61\163\x63")->paginate(10);
    goto E021694d1d524d6a;
    b4ef380f386bfff0:
}

我从UnPHP - The Online PHP Decoder解码为:

public function index()
{
    goto E9e2246508a1d047;
    b59f99a7185ea4f4:
    return View("employer.transactions", ["page" => $F44ac1942f77c961]);
    goto b4ef380f386bfff0;
    E021694d1d524d6a:
    $F44ac1942f77c961 = $C52f2627c8748472->lastpage();
    goto b59f99a7185ea4f4;
    E9e2246508a1d047:
    $C52f2627c8748472 = UserTransaction::where("user_id", Auth::id())->orderBy("created_at", "asc")->paginate(10);
    goto E021694d1d524d6a;
    b4ef380f386bfff0:
}

变量的名称对我来说不是很重要(尽管最好是真实的)。

但是我想删除goto命令并输入干净的代码。

1 个答案:

答案 0 :(得分:0)

使用gotos重写代码:

public function index()
{
    goto E9e2246508a1d047;
    E9e2246508a1d047:
    $C52f2627c8748472 = UserTransaction::where("user_id", Auth::id())->orderBy("created_at", "asc")->paginate(10);
    goto E021694d1d524d6a;
    E021694d1d524d6a:
    $F44ac1942f77c961 = $C52f2627c8748472->lastpage();
    goto b59f99a7185ea4f4;
    b59f99a7185ea4f4:
    return View("employer.transactions", ["page" => $F44ac1942f77c961]);
    goto b4ef380f386bfff0;
    b4ef380f386bfff0:
}

然后将其删除:

public function index()
{
    $C52f2627c8748472 = UserTransaction::where("user_id", Auth::id())->orderBy("created_at", "asc")->paginate(10);
    $F44ac1942f77c961 = $C52f2627c8748472->lastpage();
    return View("employer.transactions", ["page" => $F44ac1942f77c961]);
}