Skip to main content
 首页 » 编程设计

php之使用 php 命令行

2024年08月30日26telwanggs

就像我们可以在命令行解释器的命令行中使用 python 来测试小代码片段是否正常一样,我如何(或者我可以)用 PHP 做同样的事情?

ActivePython 2.7.2.5 (ActiveState Software Inc.) based on 
Python 2.7.2 (default, Jun 24 2011, 12:22:14) [MSC v.1500 64 bit (AMD64)] on win 
32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> print "abc" 
abc 
>>> 
 
C:\wamp\bin\php\php5.3.4>php -a 
Interactive mode enabled 

不给我 php 提示

有人能举个例子说明如何在 php.ini 中有一个交互式 shell 吗?

请您参考如下方法:

PHP 手册中有一节关于 command line usage .

还有关于 interactive shell 的详细信息.