我想在字符串中传递变量,以便稍后在脚本中赋值。想要在php中传递字符串变量中的varialble
$message="hi $(name) your salary $(salary) is credited in your XYZ account";
foreach($arrmsgvar as $key => $value){
$temp=array_search($value[1],$upfileformat);
if($temp){
$replacement='$row['.$temp.']';
$message=str_replace($value[0],$replacement,$message);
}
}
我得到串 “喜$行[1]你的薪水$行[2]是记在您的XYZ帐户” 中 $消息
$xdata="";
foreach($Spreadsheet as $key => $row){
$xdata.= "`$memid`|`$source`|`$mobile`|`$message`|`0`|`$msgid`||";
}
echo $xdata;
并获得1
| 2
| 12345678
| hi $row[1] your salary $row[2] is credited in your XYZ account
| 0
| 4
||,in $ xdata
我怎样才能在$ xdata最终输出中获得$ row数组的值?谁会告诉我 一种方法来做到这一点?
其实我没有$名称,$收入$帐户的值在转让时,如果你看一下我的代码$替换=“$行[”。$温度。“] “; ..我尝试传递只是变量到字符串和后来的值分配给foreach中的变量($ Spreadsheet为$ key => $ row){}在这个循环 – Ekky 2013-04-24 12:43:58