我无法理解在php中App::的定义。

huangapple go评论62阅读模式
英文:

I can not understand the definition of App:: in php

问题

我是一名系统管理员,想要修复我们网站上使用CMS制作的一个回调脚本。

经过多个小时的研究,我清楚地确定问题出在以下这段代码上:

$invoiceId = (int) App::getFromRequest("invoiceid");
$postData = [];
$postData["VPSTxId"] = App::getFromRequest("threeDSSessionData");
if (App::getFromRequest("cres")) {
    $postData["CRes"] = App::getFromRequest("cres");
} else {
    if (App::getFromRequest("PaRes")) {
        $postData["PARes"] = App::getFromRequest("PaRes");
        $postData["MD"] = App::getFromRequest("MD");
    } else {
        callback3DSecureRedirect($invoiceId, false);
    }
}

更具体地说,我认为这段代码中的以下部分未按预期工作:

App::getFromRequest

有人能解释一下PHP中的 App:: 是什么,它是如何定义的吗?

我了解 "getFromRequest" 是这个 App:: 的名称。

我在CMS代码中搜索了 App::getFromRequest,发现许多脚本都在使用它,但我找不到它的定义在哪里。

提前感谢您!

英文:

I'm a sysadmin and want to fix one callback script on our website made with CMS.

After many hours of research I clearly identified that the problem is in this code:

$invoiceId = (int) App::getFromRequest("invoiceid");
$postData = [];
$postData["VPSTxId"] = App::getFromRequest("threeDSSessionData");
if (App::getFromRequest("cres")) {
    $postData["CRes"] = App::getFromRequest("cres");
} else {
    if (App::getFromRequest("PaRes")) {
        $postData["PARes"] = App::getFromRequest("PaRes");
        $postData["MD"] = App::getFromRequest("MD");
    } else {
        callback3DSecureRedirect($invoiceId, false);
    }
}

More specifically, I think this piece of code is not working as expected:

App::getFromRequest

Can someone explain to me what is App:: in PHP and how is defined?

I understand that "getFromRequest" is the name of this App::

I made the search about App::getFromRequest inside the CMS codes, and I found that many scripts use this, but I can not find where is its definition.

Thank you in advance!

答案1

得分: 1

App 很可能是一个自定义类。以下是PHP文档中编写类的示例:

<?php
class SimpleClass
{
    // 属性声明
    public $var = '默认值';

    // 方法声明
    public function displayVar() {
        echo $this->var;
    }
}
?>

在您的情况下,您应该寻找类似以下的代码:

<?php
class App
{
    // 其他一些函数...

    // 您需要查看的函数
    public function getFromRequest() {
        // 实现该函数的更多代码...
    }
}
?>
英文:

App is most likely a custom class. Here is PHP's documentation example of how to write a class:

&lt;?php
class SimpleClass
{
    // property declaration
    public $var = &#39;a default value&#39;;

    // method declaration
    public function displayVar() {
        echo $this-&gt;var;
    }
}
?&gt;

In your case, you should probably be looking for code that looks like this instead:

&lt;?php
class App
{
    // Some other functions...

    // The function you need to look at
    public function getFromRequest() {
        // some more code implementing the function...
    }
}
?&gt;

huangapple
  • 本文由 发表于 2023年7月4日 21:57:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76613393.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定