我正在使用xampp和Windows操作系统。我试图执行简单的PHP脚本命令行,但我收到一个错误,如“无法打开输入文件http://test.localhost.com/test.php”。下面是我的相同代码。
#!/usr/local/bin/php
<?php
$stdin = fopen('php://stdin', 'r');
while (true) {
$input = fgets($stdin, 3);
if ($input == 42) {
break;
} else {
echo $input;
}
}
fclose($stdin);
exit;
我给了我上面的错误。谁能告诉我这是什么问题?
答案 0 :(得分:1)
您想要调用CLI脚本,而不是网站。
c:/path/to/php.exe c:/path/to/scrip.php