为什么这个变量回声为16?

时间:2012-05-10 16:41:10

标签: php

$body = "Artist: " + $artist + "Size: " + $size + "Time: " + $time + "Concept: " + $concept + "Time: " + $time + "Mod: " + $mod + "Details: " + $details;

当我尝试回应这个变量时,所有出现的都是'16'。

你们可以帮忙吗?

2 个答案:

答案 0 :(得分:4)

PHP中的连接运算符是.而不是+

$body = "Artist: " . $artist . "Size: " . $size . "Time: " . $time . "Concept: " . $concept . "Time: " . $time . "Mod: " . $mod . "Details: " . $details;

答案 1 :(得分:1)

在PHP中,连接运算符为.,而不是+

所以:

$body = "Artist: " . $artist . "Size: " . $size . "Time: " . $time . "Concept: " . $concept ."Time: " . $time . "Mod: " . $mod . "Details: " . $details;