douan8473 2017-05-02 21:03 采纳率: 100%
浏览 50

在回声中执行回声

I´ve this code:

 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.";
}

The problem is that I´ve an echo inside of an echo so the "switch-statement" doesn´t get executed. How do I handle thi?

  • 写回答

1条回答 默认 最新

  • dongwo8827523 2017-05-02 21:12
    关注

    You forgot to write '; after echo '<div style="background-size: 100%;..., and that's causing problems (and also the reason why the code isn't running as desired):

    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.";
    }
    
    评论

报告相同问题?