Elegant solution for line-breaks (PHP)

后端 未结 8 2029
太阳男子
太阳男子 2020-12-08 14:28
$var = \"Hi there\".\"
\".\"Welcome to my website\".\"
;\" echo $var;

Is there an elegant way to handle line-breaks in PHP? I\'

8条回答
  •  一个人的身影
    2020-12-08 15:21

    I have defined this:

    if (PHP_SAPI === 'cli')
    {
       define( "LNBR", PHP_EOL);
    }
    else
    {
       define( "LNBR", "
    "); }

    After this use LNBR wherever I want to use \n.

提交回复
热议问题