如何在phpsh中进行多行输入?

时间:2012-10-25 03:27:44

标签: phpsh

我可以这样:

php>multline start; 
.... $a =<<< EOF 
.... hello hi how are you this is phpSH 
.... hello there its test line 
.... EOF; 
.... multiline end; 

在phpsh中?

2 个答案:

答案 0 :(得分:0)

让我们举一个例子,如果是多行语句:

  1. 类型:if(condition){
  2. 点击Enter
  3. ...并写下你想要的东西。
  4. }关闭多行语句。然后按Enter键执行它。
  5. 您可以通过按ctrl + c进一步取消写入。

答案 1 :(得分:0)

也许就像这样:

php> $test = "
 ... hello hi how are you this is phpSH
 ... hello there its test line
 ... "
    <the_empty_result>
php>
php> echo $test

hello hi how are you this is phpSH
hello there its test line

php>
php> =$test
"\nhello hi how are you this is phpSH\nhello there its test line\n"

php> $test = "hello hi how are you this is phpSH
 ... hello there its test line"
    <the_empty_result>
php>
php> echo $test
hello hi how are you this is phpSH
hello there its test line
php>
php> =$test
"hello hi how are you this is phpSH\nhello there its test line"

当然,按 Enter 创建上述多行输入。