Running a Zend Framework action from command line

后端 未结 10 1335
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 17:01

I would like to run a Zend Framework action to generate some files, from command line. Is this possible and how much change would I need to make to my existing Web project t

10条回答
  •  时光说笑
    2020-11-29 17:14

    You can use wget command if your OS is Linux. For example:

    wget http://example.com/controller/action
    

    See http://linux.about.com/od/commands/l/blcmdl1_wget.htm

    UPDATE:

    You could write a simple bash script like this:

    if wget http://example.com/controller/action
        echo "Hello World!" > /home/wasdownloaded.txt
    else
        "crap, wget timed out, let's remove the file."
        rm /home/wasdownloaded.txt
    fi
    

    Then you can do in PHP:

    if (true === file_exists('/home/wasdownloaded.txt') {
        // to check that the 
    }
    

    Hope this helps.

提交回复
热议问题