English 中文(简体)
CakePHP 2 壳牌掩饰有助于/例如
原标题:CakePHP 2 Shell Arguments help / example

我似乎无法找到一个简单的具体例子,说明如何接受关于《卡纳克民阵》2号手稿的论点。

    class TestShell extends AppShell {
        public function argumentTest(){
            $parser = parent::getOptionParser();
            $parser->addArgument( testArgument , array( short  =>  t , help  =>  The test argument ));
            var_dump($this->params);
        }
    }

我随后尝试并称之为:

  • 青少年/地震测试 壳牌争辩 考试——45

  • 青少年/地震测试 壳牌争辩 测试――45

  • Console/cake TestShell argumentTest --testArgument 45

  • 青少年/地震测试 壳牌争辩 试验——抗议 45

作为回应,我收到了以下文件:

Usage:
cake lot_web_service [-h] [-v] [-q]

我做了什么错误?

最佳回答

在确定选择等级时,你应提出以下论点:

public function getOptionParser() {
    $parser = parent::getOptionParser();
    //configure parser
    return $parser;
}

这确保了在发出呼吁之前确定这些选择和论点。 另外,从它所看,你要求改写<代码>addOption(>,而不是addArgument(<>)。

问题回答

暂无回答




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

specifying date format when using $form->inputs() in CakePHP

I am wondering if there is a way to specify the date format in the forms created using CakePHP s $form->inputs(); Please note that this is not the individual $form->input() but instead $form->inputs() ...

Using DISTINCT in a CakePHP find function

I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter ...

Assistance with CakePHP model relationships

How would I represent the following in a CakePHP model? Product ======= product_id .... Cart ==== cart_id .... Carts_Products ============== cart_id product_id quantity

Prevent controller from trying to autoload model

I am a beginning Cake user and trying to do some work on an already existing application. Running into a problem when I create a new controller. I have created StoreController and when I try to call ...

热门标签