如何使PHP CLI在OS X上使用换行符



我在Mac OS X终端上的PHP交互式shell有问题。也就是说,它在每个命令后都没有换行符:

php > echo "Hello Stack Overflow!";
Hello echo "As you can see, there was no newline.";                            As you can see, there was no newline.php > echo "As you can see, there was no newlineecho "It even deletes my sentences if I go up and then down in history."; 
It even deletes my sentences if I go up and then down in history.php > 

正如你所知,我甚至不能在我的历史中大起大落,因为它破坏了缓冲区,使我不知道我在键入什么。有人知道怎么解决这个问题吗?

我的PHP版本:

$ php -v
PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
$ php > echo "Hello" . PHP_EOL . "World!";

此平台的正确"终点"符号。自PHP 4.3.10和PHP 5.0.2起提供

如果要在CLI中添加新行,请使用显式回车符:

$ php > echo "HellornWorld!";

应输出:

$ Hello
World!

相关内容

  • 没有找到相关文章

最新更新