Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将订单号添加到电子邮件正文模板中的字符串_Php_Wordpress_Woocommerce_Orders_Email Templates - Fatal编程技术网

Php 将订单号添加到电子邮件正文模板中的字符串

Php 将订单号添加到电子邮件正文模板中的字符串,php,wordpress,woocommerce,orders,email-templates,Php,Wordpress,Woocommerce,Orders,Email Templates,我正在尝试更改保留电子邮件,以便在介绍中包含订单号 我添加了“$order->get_id()”来显示订单号。不太管用。有什么想法吗 <p><?php esc_html_e( 'Thanks for your order. Your order number is $order->get_id(). Below you can find the contents of your order.', 'woocommerce' ); ?></p> 这是

我正在尝试更改保留电子邮件,以便在介绍中包含订单号

我添加了“$order->get_id()”来显示订单号。不太管用。有什么想法吗

<p><?php esc_html_e( 'Thanks for your order. Your order number is $order->get_id(). Below you can find the contents of your order.', 'woocommerce' ); ?></p>


这是因为它现在被视为字符串的一部分,它缺少连接运算符
('.')

更多信息:

像这样使用它

<p><?php esc_html_e( 'Thanks for your order. Your order number is ' . $order->get_id() . ' Below you can find the contents of your order.', 'woocommerce' ); ?></p>
但是



编辑

另一个选择:看,
双重回答,同时发布这是因为它现在被视为字符串的一部分,它缺少连接运算符
('.')

更多信息:

像这样使用它

<p><?php esc_html_e( 'Thanks for your order. Your order number is ' . $order->get_id() . ' Below you can find the contents of your order.', 'woocommerce' ); ?></p>
但是



编辑

另一个选择:看,
双重回答,同时发布

您需要在字符串中连接订单号…您可以更好地使用
printf()
WC\u order
方法
get\u order\u number()
,如下所示:

<p><?php printf( esc_html__( 'Thanks for your order. Your order number is %s. Below you can find the contents of your order.', 'woocommerce' ), $order->get_order_number() ); ?></p>


您需要在字符串中串联订单号…您可以更好地使用
printf()
WC\u order
方法
get\u order\u number()
,如下所示:

<p><?php printf( esc_html__( 'Thanks for your order. Your order number is %s. Below you can find the contents of your order.', 'woocommerce' ), $order->get_order_number() ); ?></p>