Home page >> Related Tutorials >>Body

PHP implementation of random one word code is applicable to a variety of website programs

Author: A little Jack    Time: 2022-09-01 08:50:43    Browse: 875   

From Dunga: Some websites will have a random quote, and each refresh will display a famous quote. So how does this work? Here's how to share the PHP version. After all, many of them are dynamic blogs.

 PHP implementation of random one word code is applicable to a variety of website programs

Code 1:

Hello, you need to log in to our account to view the hidden content, please first Sign in To view!

Here is an interface shared by others. Each call will have a different quote.

Code 2:

This scheme comes from Meng Kun's blog, thanks for sharing.

First prepare a code editor, then create a new php file named api.php, and then create a new file named data.dat (both files need to be encoded in UTF-8, otherwise they will be garbled).

Hello, you need to log in to our account to view the hidden content, please first Sign in To view!

The content of data.dat is a famous sentence, one sentence per line.

Call method:

 <script src="http://your website. cn/api. php"></script>

The above is about how the website realizes the function of random one word.


Text label: Random one word  
 A little Jack

A little Jack https://lkba.cn

The blogger focuses on Z-Blog website construction, website optimization, computer troubleshooting, reinstallation, optimization, maintenance system, etc., QQ/WX: 2126245521 (please specify the purpose)

Related articles

Previous:

Next:

No comment for this article - Welcome

 Please fill in the verification code

Processed : 0.051 SQL : 14