在Windows上没有PHP交互的输出 [英] No output from PHP interactive on Windows

查看:99
本文介绍了在Windows上没有PHP交互的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Win 7计算机上从xampp(5.4.7)交互式运行php,无法从窗口获取任何输出.我搜索了各种解决方案,但到目前为止没有任何效果.这是一个示例: C:\ xampp> php -v PHP 5.4.7(CLI)(内置:2012年9月12日23:48:31) 版权所有(c)1997-2012 The PHP Group Zend Engine v2.4.0,版权所有(c)1998-2012 Zend Technologies

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");

还有其他想法吗?

我还尝试了php -an并在php.ini中将output_buffing设置为Off,但无济于事.

I also tried php -an and setting output_buffing Off in the php.ini, all to no avail.

基本上,我的目标主要是将其用作php表达式的测试平台以及运行一些本地脚本.

Basically my aim is mostly to use this as a testbed for php expressions as well as running some local scripts.

推荐答案

我输入php -a后输入的第一行与您的稍有不同:

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:\Windows\System32>

麻烦的是它返回Windows命令提示符,您必须继续键入 php -a <?php ,然后才能键入更多内容.

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.

要节省一些输入,我创建了一个快捷方式,右键单击它,打开其属性"对话框,并在 Target 文本框中输入以下命令:

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:\ Windows \ System32 \ cmd.exe/k"php -a"

C:\Windows\System32\cmd.exe /k "php -a"

此快捷方式以交互方式打开PHP提示符.另外,该程序以交互模式启动,并列出了PHP开关:

This shortcut opens a PHP prompt in interactive mode. Alternatively, this one starts in interactive mode and lists the PHP switches:

C:\ Windows \ System32 \ cmd.exe/k"php -h& php -a"

C:\Windows\System32\cmd.exe /k "php -h & php -a"

这篇关于在Windows上没有PHP交互的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆