首页 > 解决方案 > 在感谢页面中编码 URL 参数并使用 Gravity 表单字段对其进行解码

问题描述

我使用了一个 WordPress 插件,它通过检索客户数据将客户重定向到个性化的感谢页面(将客户重定向到具有不同域名的新网站):订单 ID、账单电子邮件、order_total ..etc

示例:https ://example1.com/?order_id=139047&order_total=300.00&mail=billing-email@gmail.com&prenom=Joe&nom=Doe&address=123%20Quartier

// Return thankyou redirect
                return array(
                    'result'   => 'success',
                    'redirect' => ( '' == $this->custom_return_url ) ?
                        $this->get_return_url( $order ) :
                        apply_filters( 'alg_wc_custom_payment_gateway_custom_return_url',
                            str_replace(
                                array( '%order_id%', '%order_key%', '%order_total%', '%billing_email%', '%billing_last_name%', '%billing_first_name%', '%billing_city%', '%billing_address_1%'  ),
                                array( $order->get_id(), $order->get_order_key(), $order->get_total(), $order->get_billing_email(), $order->get_billing_last_name(), $order->get_billing_first_name(), $order->get_billing_city(), $order->get_billing_address_1() ),
                                htmlspecialchars_decode( $this->custom_return_url )
                            ),
                            $order )
                );
            }

然后我通过 Gravity 表单恢复这些数据以动态填写以下字段:电子邮件、姓名、地址、金额……等

我想对 URL 中的参数进行编码,以免暴露客户的数据。

请问你有解决方案吗?

谢谢

标签: wordpressstringwoocommerce

解决方案


推荐阅读