thinkphp3.2 How to use CLI mode correctly

Source: Internet
Author: User

thinkphp3.2 How to use CLI mode correctly

Create a new portal file named cli.php content with index.php unchanged, add code to define the current portal file call using command line mode define (' App_mode ', ' CLI ');
The path definition of the APP, as well as the path introduced by the framework, is changed from a relative path to an absolute path, such as: Define (' App_path ', DirName (__file__). /application/');
Under the path/thinkphp/mode there is a file, called common.php, copy it out, named Cli.php, and then put the code inside the log class to comment or delete: Kill
' Think\log ' = Core_path. ' Log '. EXT,
Delete all caches below the cache--remember that all
After the CLI mode call, use the cli.php entry file, such as scheduled task 0 * * * * * php/www/index.php home/article/get, if it is a Web service access, then the index.php file is still used

A demo
Login Controller
Register method
Php-f cli.php Home/login/register

thinkphp3.2 How to use CLI mode correctly

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: 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.