如何使用单个回显语句显示一个语句以 3 行打印


how can i show one statements to print in 3 lines using single echo statement?

这是我的代码

.PHP

<?php
    $count1 = $obj->getDatef();
    $as1 = $count1 + 6;
    $startdate = date('d/m/Y', strtotime($count1 . ' days'));
    $enddate = date('d/m/Y', strtotime($as1 . ' days'));
    echo "<script type='text/javascript'>";
    echo "alert('Current Timesheet period($startdate (Mon) ~ $enddate (Sun)) of 
              $pcode has been successfully Updated....!')";
    echo "</script>";
    echo "<script type='text/javascript'>";
    echo "window.location='my_tm.php'";
    echo "</script>";
?>

在这里它必须像这样打印.....

当前时间表期间

$startdate(星期一(~$enddate(星期日(的$pcode

已成功更新....!

有两种方法最流行的是在回显的末尾使用 ' 来换行。或者您可以使用
效率较低的标签,因为它会向您页面添加标记。

一个例子是

echo("im line one 'n im line two'n im line three");

这将输出

im line one
im line two
im line three
echo "alert('Current Timesheet period'n
             $startdate (Mon) ~ $enddate (Sun) of $pcode'n
             has been successfully Updated....!')";

这是小提琴

echo "alert('Current Timesheet period'n$startdate (Mon) ~ $enddate (Sun) of $pcode'n has been successfully Updated....!')";