问题描述
我在我的 Win 7 机器上从 xampp (5.4.7) 以交互方式运行 php,并且无法从窗口获得任何输出.我搜索了各种解决方案,但到目前为止没有任何效果.这是一个示例:C:xampp>php -vPHP 5.4.7 (cli)(构建时间:2012 年 9 月 12 日 23:48:31)版权所有 (c) 1997-2012 PHP 集团Zend Engine v2.4.0,版权所有 (c) 1998-2012 Zend Technologies
C:xampp>php -a启用交互模式
还有什么想法???
我还尝试了 php -an 并在 php.ini 中设置 output_buffing Off,但均无济于事.
基本上我的目标主要是用它作为 php 表达式的测试平台以及运行一些本地脚本.
我输入php -a
后输入的第一行和你的略有不同:
麻烦的是它会返回到 Windows 命令提示符,您必须继续输入 php -a 和 <?php 才能输入更多内容.p>
为了节省一点打字时间,我创建了一个快捷方式,右键单击它,打开其属性对话框并在 Target 文本框中输入以下命令:
<块引用>C:WindowsSystem32cmd.exe/k "php -a"
此快捷方式以交互模式打开 PHP 提示符.或者,这个以交互模式启动并列出 PHP 开关:
<块引用>C:WindowsSystem32cmd.exe/k "php -h & php -a"
I'm running php interactively from xampp (5.4.7) on my Win 7 machine and cannot get any output from the window. I searched around various solutions and nothing so far has worked. Here's a sample: C:xampp>php -v PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
C:xampp>php -a
Interactive mode enabled
<?
echo "hi";
printf "hi";
fwrite (STDOUT, "hi");
any other ideas???
I also tried php -an and setting output_buffing Off in the php.ini, all to no avail.
Basically my aim is mostly to use this as a testbed for php expressions as well as running some local scripts.
The first line I type after entering php -a
is slightly different to yours:
<?php //press Enter
echo 'This '; //press Enter
echo 'works'; //press Enter
//Press Ctrl+z on this line to get a ^Z, then press Enter
This works
C:WindowsSystem32>
The nuisance is that it returns to the Windows command prompt and you have to keep typing php -a and <?php before you can type more.
To save a bit of typing I created a shortcut, right-clicked it, opened its Properties dialog and entered the following command in the Target text box:
C:WindowsSystem32cmd.exe /k "php -a"
This shortcut opens a PHP prompt in interactive mode. Alternatively, this one starts in interactive mode and lists the PHP switches:
C:WindowsSystem32cmd.exe /k "php -h & php -a"
这篇关于Windows 上的 PHP 交互没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!