Php 电子商务中打印表单时出错

Php 电子商务中打印表单时出错,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我正在从我的支付网关为woocommerce创建一个支付网关插件。 在我通过我的支付网关点击结帐页面后。我得到了一个语法错误。我想我没有错,下面是我的过程支付功能代码 /** * Process the payment and return the result **/ function process_payment($order_id){ global $woocommerce;

我正在从我的支付网关为woocommerce创建一个支付网关插件。 在我通过我的支付网关点击结帐页面后。我得到了一个语法错误。我想我没有错,下面是我的过程支付功能代码

         /**
         * Process the payment and return the result
         **/
        function process_payment($order_id){
            global $woocommerce;
            $order = new WC_Order($order_id);
            $order_id = $order_id;
            $the_order_total = $order->order_total;
            $mercahntId=$this->merchant_id;
            $merchantPassword=$this ->merchant_password;
            $retrunUrl=$this->notify_url;
            $paymentGatewayUrl=$this ->liveurl;

            echo '<form name="Generator" method="post" action="' . $paymentGatewayUrl . '">';
            echo '<input type="hidden" name="UID" value="' . $mercahntId . '">';
            echo '<input type="hidden" name="PWD" value="' . $merchantPassword . '">';
            echo '<input type="hidden" name="ProductDesc" value="' . $order_id . '">';
            echo '<input type="hidden" name="returnURL" value="' . $retrunUrl . '">';
            echo '<input type="hidden" name="Amount" value="' . $the_order_total . '">';
            echo'</form>';
            die();

            //return array('result' => 'success', 'redirect' => $order->get_checkout_payment_url( true ));
        }
/**
*处理付款并返回结果
**/
功能流程\付款($order\ U id){
全球商业;
$order=新WC\U订单($order\U id);
$order\u id=$order\u id;
$the_order_total=$order->order_total;
$MERCHANTID=$this->merchant\u id;
$merchantPassword=$this->merchant\u密码;
$retrunUrl=$this->notify\u url;
$paymentGatewayUrl=$this->liveurl;
回声';
回声';
回声';
回声';
回声';
回声';
回声';
模具();
//返回数组('result'=>'success','redirect'=>$order->get\u checkout\u payment\u url(true));
}

它给了我一个错误SyntaxError:Unexpected token产生错误的可能不是HTML的语法。服务器可能正在生成HTML响应(从
开始)。产生错误的可能不是HTML语法。服务器可能正在生成HTML响应(从
开始,当用户在WooCommerce中提交订单时,会触发支付网关的流程支付方法。该功能使用Ajax运行。我相信尝试打印该功能中的任何内容都会导致错误。如果您在开发和调试插件时需要查看数据,请尝试使用wc\u add_注意函数,不要将结果返回为成功。

当用户在WooCommerce中提交订单时,会触发支付网关的支付方法。该函数使用Ajax运行。我相信尝试在该函数中打印任何内容都会导致错误。如果您需要在开发和调试时查看数据在你的插件中,尝试使用wc_add_notice函数,不要将结果返回为success