Wordpress 如何在附件数组路径中传递变量?
我如何在附件路径中传递变量,您可以在我试图传递的代码末尾看到,Wordpress 如何在附件数组路径中传递变量?,wordpress,email,woocommerce,Wordpress,Email,Woocommerce,我如何在附件路径中传递变量,您可以在我试图传递的代码末尾看到,。$img_post.,如果编写145566.png,则可以,但下面的代码对我不起作用 $attachments = array( '/home2/rahulr/public_html/cutting- edge/wordpress_theme/user_templates/'.$img_post.'' ); 您的语法不正确,以下应该可以使用(前提是$img\u post实际包含所需的值): 我也应该把它标记为php。打印时,
。$img_post.
,如果编写145566.png,则可以,但下面的代码对我不起作用
$attachments = array( '/home2/rahulr/public_html/cutting- edge/wordpress_theme/user_templates/'.$img_post.'' );
您的语法不正确,以下应该可以使用(前提是
$img\u post
实际包含所需的值):
我也应该把它标记为php。打印时,
$img\u post
是否显示145566.png
?此外,我建议您使用双引号(“”)而不是单引号(“”)。
$attachments = array( '/path/to/' . $img_post );