我不是PHP程序员,但过去曾调整过一些。如何在这段代码中添加一些内容,以使公司,街道和城市全部上限?
protected function getCommonOrderValues($order)
{
$shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
$billingAddress = $order->getBillingAddress();
return array(
$shippingAddress ? $shippingAddress->getData("company") : '',
$shippingAddress ? $shippingAddress->getName() : '', '', '',
$shippingAddress ? $shippingAddress->getData("street") : '', '', '',
$shippingAddress ? $shippingAddress->getData("city") : '',
$shippingAddress ? $shippingAddress->getRegionCode() : '',
$shippingAddress ? $shippingAddress->getData("postcode") : '',
$shippingAddress ? $shippingAddress->getCountry() : '', 'standard',
$order->getRealOrderId(),
$shippingAddress ? $shippingAddress->getData("telephone") : '', '',
);
}
答案 0 :(得分:4)
使用strtoupper
。
$shippingAddress ? $shippingAddress->getData("company") : '',
变为:
$shippingAddress ? strtoupper($shippingAddress->getData("company")) : '',
答案 1 :(得分:0)
使用strtoupper功能:
答案 2 :(得分:0)
使用PHP的strtoupper()函数。例如:
strtoupper($shippingAddress->getData("company")),
答案 3 :(得分:0)
protected function getCommonOrderValues($order)
{
$shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
$billingAddress = $order->getBillingAddress();
return array(
$shippingAddress ? strtoupper( $shippingAddress->getData("company") ) : '',
$shippingAddress ? $shippingAddress->getName() : '', '', '',
$shippingAddress ? strtoupper( $shippingAddress->getData("street") ) : '', '', '',
$shippingAddress ? strtoupper( $shippingAddress->getData("city") ) : '',
$shippingAddress ? $shippingAddress->getRegionCode() : '',
$shippingAddress ? $shippingAddress->getData("postcode") : '',
$shippingAddress ? strtoupper( $shippingAddress->getCountry() ): '', 'standard',
$order->getRealOrderId(),
$shippingAddress ? $shippingAddress->getData("telephone") : '', '',
);
}