Go to PHP.

Source: Internet
Author: User
Come in with PHP. & lt ;? Phpif ($ downhits2) {echo & nbsp; & lt; div & nbsp; & gt; & nbsp; & nbsp; {loop & PHP understanding
If ($ downhits = 2)
{
Echo'



{Loop $ downfile $ r}

  • {$ R}

  • {/Loop}
    {Loop $ downfiles $ r}
  • {$ R}

  • {/Loop}

    ';
    }
    Else
    {
    Echo'



    {Loop $ downfile $ r}

  • {$ R}

  • {/Loop}
    {Loop $ downfiles $ r}
  • {$ R}

  • {/Loop}

    ';}
    ?>

    The above code is output in echo, but this $ r and $ downfiles do not seem to respond, so I would like to ask how to output $ r and $ downfiles in echo, or how to call or use the syntax. right

    Share :?????????? {Loo... 'data-pics = ''>


    ------ Solution --------------------
    First, variables in single quotes in PHP cannot be parsed as variable values.

    So replace your echo 'xxxxxxxxxxxxxxxxxx' with echo "xxxxxxxxxxx" (and replace the internal double quotation marks with single quotation marks)

    Secondly, I don't understand the environment in which such a statement is used. can it be a normal loop? the above method is only for the problem that the two variables you asked cannot be parsed.
    ------ Solution --------------------
    I do not understand php, but I know that variables are not included in single quotes. I only use the variable name as a string.


    ------ Solution --------------------
    The loop tag is a custom template loop tag of PHPcms. here, echo outputs the string to the template. the variable $ downfiles is allocated to the controller file corresponding to the template, loop then outputs the variable cyclically. $ downfiles is the value in the array $ r.
    ------ Solution --------------------
    If ($ downhits = 2)
    {
    Echo'

    ';

    {Loop $ downfile $ r}

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.