第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

獲取函數(shù)內(nèi)字符串的值

獲取函數(shù)內(nèi)字符串的值

PHP
紅顏莎娜 2023-09-22 17:40:30
所以就有了這個(gè)函數(shù):function rpress_get_service_types() {  $service_types = array(    'delivery'  => __( 'Delivery', 'restropress' ),    'pickup'    => __( 'Pickup', 'restropress' )  );  return apply_filters( 'rpress_service_type', $service_types );}我想從中獲得價(jià)值。比方說,是'delivery'還是'pickup'?然后,我需要知道整個(gè)代碼引用的產(chǎn)品是否設(shè)置為 or 'pickup'-'delivery'每個(gè)產(chǎn)品僅分配給這兩個(gè)值之一。因此,在我嘗試驗(yàn)證它是否與這兩個(gè)值之一匹配之前,我想我應(yīng)該將其打印在我發(fā)送給自己的測(cè)試電子郵件中......以查看它是否有效。下面的代碼返回The order #2262 is ready for delivery!Arraytest我作為測(cè)試收到的電子郵件的值:function send_customer_purchase_notification_ready( $payment_id, $new_status ) {    $pickup_or_delivery = rpress_get_service_types( $service_types );    $order_status = rpress_get_option( $new_status );    $check_notification_enabled = isset( $order_status['enable_notification'] ) ? true : false;    if ( !empty( $payment_id ) && $check_notification_enabled && $new_status !== 'pending' && $new_status == 'ready' ) {                          $message = 'The order #' .$payment_id. ' is ready for delivery!' .$pickup_or_delivery. 'test';        $to = 'email@gmail.com';        $subject = "READY FOR PICKUP";        $headers = '';         //Here put your Validation and send mail        $sent = wp_mail($to, $subject, strip_tags($message), $headers);    }}add_action( 'rpress_update_order_status', 'send_customer_purchase_notification_ready' , 10, 2 );正如你所看到的,我將變量放在里面$message = 'The order #' .$payment_id. ' is ready for delivery!' .$pickup_or_delivery. 'test';總結(jié)一下:此代碼顯示單詞Array。我已經(jīng)嘗試移動(dòng)?xùn)|西好幾個(gè)小時(shí)了,但我感覺自己在撞墻。有任何想法嗎?
查看完整描述

1 回答

?
偶然的你

TA貢獻(xiàn)1841條經(jīng)驗(yàn) 獲得超3個(gè)贊

如您所見,rpress_get_service_types()將會(huì)返回一個(gè)數(shù)組,因此$pickup_or_delivery是一個(gè)數(shù)組。

您不能將字符串The order #2262 is ready for delivery!..數(shù)組連接起來。如果需要,您應(yīng)該使用implode將數(shù)組轉(zhuǎn)換為字符串,或者使用ob_get_clean獲取緩沖區(qū)內(nèi)容

$pickup_or_delivery = rpress_get_service_types();


// get the imploded version

$pickup_or_delivery = implode(',', $pickup_or_delivery);


// or get the buffer content

ob_start();

print_r($pickup_or_delivery);

$pickup_or_delivery = ob_get_clean();


查看完整回答
反對(duì) 回復(fù) 2023-09-22
?
Helenr

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超4個(gè)贊

使用以下代碼獲取“服務(wù)類型”:

$service_type = rpress_get_service_type( $payment_id );


查看完整回答
反對(duì) 回復(fù) 2023-09-22
  • 1 回答
  • 0 關(guān)注
  • 137 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)