php variable inside echo 'html code'

前端 未结 6 485
借酒劲吻你
借酒劲吻你 2020-11-28 16:12

I have php file index.php

In this file to use html code I am doing:

index.php

echo \'

      
6条回答
  •  甜味超标
    2020-11-28 16:53

    if you are echoing php directly into html i like to do this

    much shorter than writing the whole thing out (php echo blah blah)

    if you are writing html in php directly then there several options

    $var = '
    '.$variable.'
    '; // concatenate the string $var = "
    $variable
    "; // let php parse it for you. requires double quotes $var = "
    {$variable}
    "; // separate variable with curly braces, also requires double quotes

提交回复
热议问题