[英]How do I make the PHP CLI use newlines on OS X?
我對Mac OS X終端上的PHP交互式外殼有問題。 即,每個命令后沒有換行符:
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 "Hello\r\nWorld!";
應該輸出:
$ Hello
World!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.