简体   繁体   English

命令行输出问题

[英]output issue with command line

main.php main.php

<?php
mb_internal_encoding("UTF-8");
require_once('./TController.php');

TController::doMain($argc, $argv);

return 0;
?>

TController.php TController.php

<?php
require_once(dirname(__FILE__)."/A.php");
require_once(dirname(__FILE__)."/../../B.php");
require_once(dirname(__FILE__)."/../../C.php");
require_once(dirname(__FILE__)."/D.php");
require_once(dirname(__FILE__)."/E.php");
class TController
{
    public function doMain($argc, $argv)
    {
        StockPriceDefiner::defineStock();

        if($argc != 10) {
            $file = "main.php";
            echo <<<EOT
usage:
php $file year month day width 500 ana_ana isDiv

ex):
input parameters
EOT;
            return;
        }
        print_r($argv); 
    }
}
?>

I have tried to php main.php [enter] from the command prompt but the usage above isn't displayed. 我尝试从命令提示符处对php main.php [enter]进行php main.php [enter] ,但未显示上述用法。 is there anything incorrect you can spot, please help me. 有什么不对劲的地方吗,请帮帮我。

[ UPDATE ] [ 更新 ]
there is no error, just nothing is displayed. 没有错误,仅显示任何内容。

Please enable error report by adding 请通过添加启用错误报告

error_report(E_ALL);

at the start of your main.php file. 在main.php文件的开头。

Secondly, if TController.php file is all you have pasted, then it certainly doesn't contain any definition of 其次,如果您仅粘贴了TController.php文件,则该文件肯定不包含以下内容的任何定义:

TravelJpController::doMain()

This should do the trick: 这应该可以解决问题:

TController::doMain($argc, $argv);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM