Home  >  Article  >  Backend Development  >  Several ways to execute php scripts

Several ways to execute php scripts

王林
王林Original
2019-10-21 11:49:073288browse

Several ways to execute php scripts

Method 1:

Use the linux scheduled task shell script, use the shell command, and curl to specify the interface to connect to the database and store it in the database .

Method 2:

Specify a routing address, and then use some monitoring service platforms on the Internet, such as 360, etc. to regularly request the routes you have written for regular processing. business.

Method 3:

Write a shell script and regularly execute the URL routing written by curl yourself. This is relatively simple.

Linux scheduled tasks are divided into units at least, so you need to execute a custom script to process it in seconds.

The following is the script: the step variable value represents execution every second

    #!/bin/bash
    step=10
     
    for (( i = 0; i < 60; i=(i+step) )); do
        $(curl &#39;http://104.224.134.48/mobile/common/getGrabbingResult&#39;)
        sleep $step
    done
     
    exit 0

Recommended tutorial: PHP video tutorial

The above is the detailed content of Several ways to execute php scripts. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn