[英]php.exe is having some issues
I am issuing command line php to run a php script but suddenly there is nothing output after I try 我正在发布命令行php以运行php脚本,但在尝试后突然没有任何输出
php function.php parameters
Nothing is displayed. 什么都没有显示。
What is going on ? 到底是怎么回事 ?
C:>php function.php 111 [Enter]
C:>
<?php
function main($argc, $argv)
{
if($argc!=2)
{
echo "wrong parameters";
return;
}
//do it
}
?>
I try php function.php
it doesn't print the echo statement, 我尝试
php function.php
它不显示echo语句,
Your script is just defining a function named main
. 您的脚本仅定义了一个名为
main
的函数。 PHP does not have a function that it automatically executes; PHP没有自动执行的功能 ; it just starts executing the script .
它只是开始执行脚本 。 Either get rid of the function definition or call
main
yourself. 摆脱函数定义或自己调用
main
。 For example: 例如:
<?php
if($argc == 3) {
echo $argv[1] + $argv[2], "\n";
}else{
echo "Two parameters are required.\n";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.