我有这段代码:
echo '<div style="background-size: 100%; background-repeat: no-repeat;
background-image:url(http://render-api-eu.worldofwarcraft.com/static-
render/eu/' . $newString.');">
switch ($rasse) {
case "11":
echo "Tauren";
break;
case "12":
echo "Troll!";
break;
default:
echo "No Character.";
}
问题是我在回声内部回声,所以“switch-statement”没有被执行。我该如何处理?
答案 0 :(得分:1)
您忘记在';
之后编写echo '<div style="background-size: 100%;...
,这会导致问题(以及代码未按预期运行的原因):
echo '<div style="background-size: 100%; background-repeat: no-repeat;
background-image:url(http://render-api-eu.worldofwarcraft.com/static-render/eu/' . $newString.');">';
switch ($rasse) {
case "11":
echo "Tauren";
break;
case "12":
echo "Troll!";
break;
default:
echo "No Character.";
}