Terminal 在命令行中打印更好的格式
我有一个通过命令行运行的php脚本,比如Terminal 在命令行中打印更好的格式,terminal,php,Terminal,Php,我有一个通过命令行运行的php脚本,比如 php file.php 在那个文件里我有一个打印语句,比如 print "<br>Saved the url: {$url} to :{$destination}"; 您是否尝试过\n\r\n用于html。控制台不同。您是否尝试过\n\r\n用于html。控制台不同。使用换行符而不是br print "\nSaved the url: {$url} to :{$destination}"; 如果您希望将其与html输出一起使用,您可以
php file.php
在那个文件里我有一个打印语句,比如
print "<br>Saved the url: {$url} to :{$destination}";
您是否尝试过\n\r\n
用于html。控制台不同。您是否尝试过\n\r\n
用于html。控制台不同。使用换行符而不是br
print "\nSaved the url: {$url} to :{$destination}";
如果您希望将其与html输出一起使用,您可以检查正在运行的sapi:
echo PHP_SAPI == 'cli' ? PHP_EOL : '<br>', "Saved the url: {$url} to :{$destination}";
echo PHP_SAPI=='cli'?PHP_EOL:“
”,“将url:{$url}保存到:{$destination}”;
使用换行符代替br
print "\nSaved the url: {$url} to :{$destination}";
如果您希望将其与html输出一起使用,您可以检查正在运行的sapi:
echo PHP_SAPI == 'cli' ? PHP_EOL : '<br>', "Saved the url: {$url} to :{$destination}";
echo PHP_SAPI=='cli'?PHP_EOL:“
”,“将url:{$url}保存到:{$destination}”;
如果您不介意输出中的BRs,则始终可以同时执行这两项操作-
\n
如果您不介意输出中的BRs,则始终可以同时执行这两项操作-
\n
echo PHP_SAPI == 'cli' ? PHP_EOL : '<br>', "Saved the url: {$url} to :{$destination}";