[英]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.