Home > Backend Development > PHP Problem > Several ways to execute php scripts

Several ways to execute php scripts

王林
Release: 2023-02-27 15:48:01
Original
3338 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template