How to execute in PHP interactive mode

前端 未结 2 893
悲&欢浪女
悲&欢浪女 2021-02-12 03:45

I am new to PHP, and I just wanted to run PHP in a command prompt (interactive mode).

So I typed this code:

`php -v`
``
         


        
2条回答
  •  既然无缘
    2021-02-12 04:23

    Ctrl+d will trigger an end-of-file condition and cause the script to be executed.

    See also How does the interactive php shell work?

    Interactive Shell and Interactive Mode are not the same thing, despite the similar names and functionality.

    If you type php -a and get a response of 'Interactive Shell' followed by a php> prompt, you have interactive shell available (PHP was compiled with readline support). If instead you get a response of 'Interactive mode enabled', you DO NOT have interactive shell available and this article does not apply to you.

    So if you get only "Interactive mode enabled", then you'll only be able to type in PHP code and then when you're done, send PHP an EOF to execute it.

    "EOF" means "end-of-file".

提交回复
热议问题