$replacements = array(
'{order_id}' => $order_id,
'{site_url}' => $settings["site_url"],
'{email}' => $user_email,
'{last_name}' => $last_name,
'{phone}' => $phone,
'{order_total}' => currency_format($order_total),
);
foreach($replacements as $param => $value){
$sms = str_replace($param, $value, $db2->f('sms'));
$user_to = str_replace($param, $value, $db2->f('user_to'));
$user_from = str_replace($param, $value, $db2->f('user_from'));
$user_subject = str_replace($param, $value, $db2->f('user_subject'));
$user_body = str_replace($param, $value, $user_body);
$admin_to = str_replace($param, $value, $db2->f('admin_to'));
$admin_from = str_replace($param, $value, $db2->f('admin_from'));
$admin_subject = str_replace($param, $value, $db2->f('admin_subject'));
$admin_body = str_replace($param, $value, $db2->f('admin_body'));
}
问题是什么?为什么不能工作?数组到字符串的转换......
谁能建议在这种情况下如何减少代码行数?