[英]PHP “if empty” help Joomla - VirtueMart
我在使用此代碼時遇到麻煩。 如果字段customer_note
為空,則如果字段中有文本,則需要它返回N
和Y
的值。 所得的Y
或N
將傳遞到XML行中。 我正在使用PHP 5.2.9。
謝謝。
if( !empty( $customer_note )) {
$shopper_message .= $customer_note."\n";
} else {
$shopper_message .= "\n";
}
我不確定您是否要這樣:
< ?php
function check_ifempty($customer_note)
{
if (empty($customer_note))
{
return "N";
}
else
{
return "Y";
}
}
?>
< ?php
$customer_note = $_POST["customer_note"];
$result = check_ifempty($customer_note);
$xml .= $result;
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.