尝试在PHP中使用字符串替换函数但不起作用
我有一个名为$info['order-total']的变量,它包含一些html,其中包含字符串'Delivery'和'Collection'。我试图用字符串“卡费”替换这些。下面是我试图实现这一点的代码。我希望有人能帮我,我是初学者,谢谢:尝试在PHP中使用字符串替换函数但不起作用,php,str-replace,Php,Str Replace,我有一个名为$info['order-total']的变量,它包含一些html,其中包含字符串'Delivery'和'Collection'。我试图用字符串“卡费”替换这些。下面是我试图实现这一点的代码。我希望有人能帮我,我是初学者,谢谢: <?php $total = str_replace("Delivery", "Card Charge", $info['order_total']); $total = str_replace("Collection", "Card Char
<?php
$total = str_replace("Delivery", "Card Charge", $info['order_total']);
$total = str_replace("Collection", "Card Charge", $info['order_total']);
print $total;
?>
试试这个:
<?php
$total = str_replace("Delivery", "Card Charge", $info['order_total']);
$total = str_replace("Collection", "Card Charge", $total);
print $total;
?>