PHP Echo a large block of text

后端 未结 11 888
南方客
南方客 2021-01-30 21:00

Im new to PHP and I can\'t figure out what the rules are for using the echo function. For example, if I need to echo a large block of css/js, do I need to add echo to each line

11条回答
  •  一整个雨季
    2021-01-30 21:34

    One option is to get out of the php block and just write HTML.

    With your code, after the opening curly brace of your if statement, end the PHP:

    if (is_single()) { ?>
    

    Then remove the echo ' and the ';

    After all your html and css, before the closing }, write:

    If the text you want to write to the page is dynamic, it gets a little trickier, but for now this should work fine.

提交回复
热议问题