当我在终端(php index.php)上运行一个循环时,我遇到了CI4的一些问题,我没有看到实时的echo,只有当脚本完成运行时,它才将所有这些echo一起打印出来。过去在CI3中,我看到每个循环都实时打印到终端屏幕上:
$stop = 10000000000000000;
for($index_start=0;$index_start<$stop;$index_start+=10){
echo $index_start."\n";
}
当我在终端(php index.php)上运行一个循环时,我遇到了CI4的一些问题,我没有看到实时的echo,只有当脚本完成运行时,它才将所有这些echo一起打印出来。过去在CI3中,我看到每个循环都实时打印到终端屏幕上:
$stop = 10000000000000000;
for($index_start=0;$index_start<$stop;$index_start+=10){
echo $index_start."\n";
}
1条答案
按热度按时间kd3sttzy1#
CI4使用特殊的CLI库。要直接输出文本,请使用CLI::write。不需要额外的换行符。