How thinkphp operates in Cli mode.

Source: Internet
Author: User
The job requires that the code being run is integrated into CLI mode.
Php-f/var/www/weibok/index_cli.php Action Funciton


The project is thinkphp 2.1, then look at the manual, said define (' Mode_name ', ' Cli '). The results are useless. A look. There is no mode_name at all in 2.1, but define (' Think_mode ', ' Cli '). However, still no, no matter what module to run, are transferred to the home page.

Not even under the thinkphp of 3.0. Also jump to the home page.

Have you ever developed thinkphp Cli mode? Tell me what to do. Thank you, everyone.


Reply to discussion (solution)

13.7.4 Command mode
Command mode is used to support command-line mode for the following PHP applications, which need to be set in the Portal file:

Define (' Mode_name ', ' CLI ')? Run with CLI run mode

Under command mode, two command-line parameter modes are supported,

One, pathinfo parameter mode (Url_model is 1)

In the PathInfo parameter mode, we can call the module and the operation

index.php MODULE/ACTION/ID/4

Second, common parameter mode (Url_model set to other)

Under normal parameter mode, we need to invoke the module and operation

index.php Module Action ID 4

Under command-line mode, the system automatically converts the parameters to get variables, regardless of which command-line argument pattern we use, we can get the parameters directly using the Get variable, for example, by invoking the following method

index.php INFO/READ/CATEGORY/2/ID/4

In the controller, we can directly get $_get[' category ' (here is 2) and $_get[' ID ' (here is the 4) parameter, if you need to parse the incoming parameter order and value yourself, you need to use the native system variable $_server[' argv ' ] to get the parameters.

I have encountered the same problem, did not solve, do not know landlord now have to solve

Look, ha, can I help you?

Entry file define (' App_debug ', false); try it.

I also met the same problem, I do not know whether the landlord is not the successor?

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.