使用未定义的常量STDIN-在第5行的C:\ wamp \ www \ study \ sayHello.php中假定为"STDIN" [英] Use of undefined constant STDIN - assumed 'STDIN' in C:\wamp\www\study\sayHello.php on line 5
本文介绍了使用未定义的常量STDIN-在第5行的C:\ wamp \ www \ study \ sayHello.php中假定为"STDIN"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想学习php& mySQL和我购买了一本书(php& mySql:缺少的手册2edition)
I want to Learn php & mySQL and I purchased a book (php&mySql: the missing manuals 2edition)
我在win8 64位计算机上安装了Wampserver2.4.
I installed Wampserver2.4 on win8 64bit machine.
服务器配置
Apache版本:2.4.4
PHP版本:5.4.12
Apache Version : 2.4.4
PHP Version : 5.4.12
在第一课中,我得到了这个错误:(
in first lesson i got this error :(
Notice: Use of undefined constant STDIN - assumed 'STDIN' in C:\wamp\www\study\sayHello.php on line 5
这是文件"sayHello.php"上的php代码
this is the php code on file "sayHello.php"
<?php
echo "Hello there. So I hear you're learning to be a PHP programmer!\n";
echo "Why don't you type in your name for me:\n";
$name = trim(fgets(STDIN));
echo "\nThanks, " . $name . ", it's really nice to meet you.\n\n";
?>
推荐答案
只需在文件顶部定义STDIN
常量,
Just define STDIN
constant at top of your file,
define('STDIN',fopen("php://stdin","r"));
这篇关于使用未定义的常量STDIN-在第5行的C:\ wamp \ www \ study \ sayHello.php中假定为"STDIN"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文