thinkphp3.2 How to use CLI mode correctly
Method/Step
1
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 ');
2
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/');
3
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,
END
Precautions
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