【发布时间】:2011-11-03 15:50:33
【问题描述】:
我在 myfile.php 中有以下内容
$json_data = '{"type":"email","msg":"some text"}';
我不想输入“电子邮件”或“一些文本”,而是想将 php 变量 $thetype 和 $themsg 连接到之前的行。
我该怎么做?无论我做什么,我都会收到语法错误。
我正在尝试:
$json_data = '{"type":"+$thetype+","msg":"+$themsg+"}';
但正如我所说的错误很多。
非常感谢
【问题讨论】:
标签: php string json variables concatenation