Php 意外捕获

Php 意外捕获,php,Php,第64行的意外t_捕获 if (strcasecmp( $_SERVER['REQUEST_METHOD'], 'post' ) == 0) { if (( isset( $_POST['env_key'] ) && isset( $_POST['data'] ) )) { $privateKeyFilePath = $_SERVER['DOCUMENT_ROOT'] . '/system/modules/gateway/mobilpay/certific

第64行的意外t_捕获

if (strcasecmp( $_SERVER['REQUEST_METHOD'], 'post' ) == 0) {
    if (( isset( $_POST['env_key'] ) && isset( $_POST['data'] ) )) {
        $privateKeyFilePath = $_SERVER['DOCUMENT_ROOT'] . '/system/modules/gateway/mobilpay/certificate/private.key';
        $objPmReq = Mobilpay_Payment_Request_Abstract::factoryfromencrypted( $_POST['env_key'], $_POST['data'], $privateKeyFilePath );
        switch ($objPmReq->objPmNotify->action) {
            case 'confirmed': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'confirmed_pending': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'paid_pending': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'paid': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'canceled': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'credit': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            default: {
                $errorType = CONFIRM_ERROR_TYPE_PERMANENT;
                $errorCode = ERROR_CONFIRM_INVALID_ACTION;
                $errorMessage = 'mobilpay_refference_action paramaters is invalid';
                break;
            }
        }
        catch ( Exception $e )  { line 64
            $errorType = CONFIRM_ERROR_TYPE_TEMPORARY;
            $errorCode = $e->getCode(  );
            $errorMessage = $e->getMessage(  );
            $headers = 'From: You <you@essence.com>' . '';
            $headers .= 'MIME-Version: 1.0' . '';
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . '';
            $req = '';

            if (( $_REQUEST || $_POST )) {
                foreach ($_REQUEST as $val) {
                }
            }

            $get_req = '';
            foreach ($_GET as $get_val) {
                $get_req .= $get_val;
            }
我该怎么办

[10-Oct-2014 22:09:14 Europe/Bu加勒斯特]PHP解析错误:语法错误,第64行出现意外的T_CATCH in/home/lagramad/public_html/discounters/system/modules/gateway/mobilpay/cardConfirm.PHP

if (strcasecmp( $_SERVER['REQUEST_METHOD'], 'post' ) == 0) {
    if (( isset( $_POST['env_key'] ) && isset( $_POST['data'] ) )) {
        $privateKeyFilePath = $_SERVER['DOCUMENT_ROOT'] . '/system/modules/gateway/mobilpay/certificate/private.key';
        $objPmReq = Mobilpay_Payment_Request_Abstract::factoryfromencrypted( $_POST['env_key'], $_POST['data'], $privateKeyFilePath );
        switch ($objPmReq->objPmNotify->action) {
            case 'confirmed': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'confirmed_pending': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'paid_pending': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'paid': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'canceled': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            case 'credit': {
                $errorMessage = $objPmReq->objPmNotify->getCrc(  );
                break;
            }

            default: {
                $errorType = CONFIRM_ERROR_TYPE_PERMANENT;
                $errorCode = ERROR_CONFIRM_INVALID_ACTION;
                $errorMessage = 'mobilpay_refference_action paramaters is invalid';
                break;
            }
        }
        catch ( Exception $e )  { line 64
            $errorType = CONFIRM_ERROR_TYPE_TEMPORARY;
            $errorCode = $e->getCode(  );
            $errorMessage = $e->getMessage(  );
            $headers = 'From: You <you@essence.com>' . '';
            $headers .= 'MIME-Version: 1.0' . '';
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . '';
            $req = '';

            if (( $_REQUEST || $_POST )) {
                foreach ($_REQUEST as $val) {
                }
            }

            $get_req = '';
            foreach ($_GET as $get_val) {
                $get_req .= $get_val;
            }
在整个代码中使用$\u POST['..somevalue..']。因此,只要“somevalue”在_POST中不存在,就会出现“未定义索引”错误

通过将行替换为以下内容来解决此问题:

$shippingAddress->mobilePhone = ( isset($_POST['shipping_mobile_phone']) ? $_POST['shipping_mobile_phone'] : '' );

请在发布另一份副本之前进行搜索。