我有一些像這樣的內容需要替換{{values}}。我如何在php中執行此操作。如何在PHP中的一個函數中替換所有字符串?如何簡化str中的替換php
$mail ="Dear {{ name }} ,
Your warranty is going to expired in {{ count }} days. Please kindly renew it trhough your dashboard or drop a check. For further details call our sales dept at 1231212121212
Confirmation id: {{ confid }}
Warranty Period: {{ Effctivedate }} - {{ Expirydate }}
Property Address: {{ Address }}";
PHP
echo str_replace('{{ name }}','Test',$mail);
問題在哪裏? 'str_replace('** mixed $ search,mixed $ replace **,'mixed $ subject [,int&$ count])' – Rizier123
其工作正常只爲我需要替換的名字'{{confid}}' {{Effctivedate}} - {{Expirydate}}'和'{{Address}}'在一個函數中,我該怎麼做? –
[** RTM **](http://php.net/manual/en/function.str-replace.php) - > **混合** $搜索,**混合** $替換< - 意味着它也將'數組'作爲參數。 – Rizier123