Run crond and thinkphpcrond in Thinkphp.

Source: Internet
Author: User

Run crond and thinkphpcrond in Thinkphp.
Enable cli support for thinkphp1. tp supports cli command mode. The path of the Manual is 13.7.4. If other frameworks do not support cli, you can only write programs directly, it is actually the most basic php code for process-oriented writing. 2. Open the command in the portal file and add a define ('mode _ name', 'cl'). The website generally has modules that can be accessed through webpages, therefore, you can create a cli entry such as index_cli.php, so that other modules can enter through the normal portal. In some manuals, the cli defines define ('Think _ mode', 'cli '). It may be of different versions. Pay attention to this.

/Bin/php/home/nginx/html/pet/index. php Crond/test

# The above is the test method executed by the shell script under crond

 

 
Why does the following code always return an error when adding data in THINKPHP?

1: Does the id of your data table set a primary key? If you insert $ id with the same value each time, the insertion will fail. Set id to auto-increment, and delete $ data ['id'] = "$ id.
2: $ oline = M ("Oline ");
$ Data ["id"] = "$ id ";
$ Data ["to"] = "$ ";
$ Data ["time"] = "$ t ";
$ Data ["ip"] = "$ _ ip ";
$ Oline-> add ($ data );
Echo $ oline-> getlastsql (); exit;
Copy the output SQL statement to mysql for execution.

How does THINKPHP allow all methods in a class to execute a verification method before execution?

If it is simple, you can first write a class, execute some verification methods in this class, and then let the class you execute inherit from this class.

In fact, there is a better example in thinkphp that meets your requirements.
It is called RBAC, that is, permission control management.
You can go to the following Example on the official website: RBAC in the Example file.

As for the specific usage method, we recommend that you take a look at this video, which is very detailed. You can proceed step by step !!
Www.tudou.com/programs/view/YyfoP5pzdBo/

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.