当前位置:网站首页>Build your own random wallpaper API for free
Build your own random wallpaper API for free
2022-07-05 07:30:00 【SongErrors】
Use github
Store image +jsdelivr
CDN To speed up access
Come to my station to read : Early station
1、 Create a new one github
Open warehouse
Such as wallpaper-transverse
2、 Upload picture files to github Warehouse
Before uploading, the file processing batch command is 0.jpg、1.jpg2、2.jpg……
3、 To configure jsdelivr Speed up
Copy any picture and link to https://www.jsdelivr.com/github convert to jsdelivr link
Such as https://github.com/UniqueYou/wallpaper-transverse/blob/main/0.jpg Convert to
https://cdn.jsdelivr.net/gh/UniqueYou/[email protected]/0.jpg
4、 Create a random.php
File upload to web The server
[scode type=“blue”] Need to change to your own $picpath
Address and random number
[/scode]
<?php
// Initialize the random number generator , This line of code can also be deleted
$seed = time();
// Get random numbers
$num = mt_rand(0,98);
// Splice picture address
$picpath = "https://cdn.jsdelivr.net/gh/UniqueYou/[email protected]/".$num.".jpg";
// Relocate to picture
die(header("Location: $picpath"));
?>
[scode type=“green”] Recommended mt_rand()
instead of rand()
[/scode]mt_rand()
Function USES Mersenne Twister
The algorithm generates random integers .
Tips : This function is a better choice for generating random values , The speed of returning results is rand()
Functional 4
times . Tips : If you want one between 10 and 100 Between ( Include 10 and 100) Random integer of , Please use mt_rand (10,100).
[scode type=“green”] You can also use my API[/scode]
https://www.songonline.top/random.php
边栏推荐
- Set theory of Discrete Mathematics (I)
- Concurrent programming - deadlock troubleshooting and handling
- Delayqueue usage and scenarios of delay queue
- 第 2 章:小试牛刀,实现一个简单的Bean容器
- 【Node】npm、yarn、pnpm 区别
- Basic series of SHEL script (I) variables
- HDU1232 畅通工程(并查集)
- Selenium element positioning
- Hdu1232 unimpeded project (and collection)
- Matrix keyboard scan (keil5)
猜你喜欢
Self summary of college life - freshman
Delayqueue usage and scenarios of delay queue
Line test -- data analysis -- FB -- teacher Gao Zhao
The folder directly enters CMD mode, with the same folder location
Target detection series - detailed explanation of the principle of fast r-cnn
[node] NVM version management tool
[software testing] 03 -- overview of software testing
611. 有效三角形的个数
Matrix and TMB package version issues in R
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
随机推荐
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
Basic series of SHEL script (II) syntax + operation + judgment
GPIO port bit based on Cortex-M3 and M4 with operation macro definition (can be used for bus input and output, STM32, aducm4050, etc.)
Basic series of SHEL script (I) variables
The golang timer uses the stepped pit: the timer is executed once a day
Professional knowledge of public security -- teacher bilitong
Rough notes of C language (1)
And play the little chestnut of dynamic agent
Use go language to read TXT file and write it into Excel
Course learning accumulation ppt
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
[solved] there is something wrong with the image
Mathematical analysis_ Notes_ Chapter 8: multiple integral
SOC_ SD_ DATA_ FSM
目标检测系列——Faster R-CNN原理详解
Miracast技术详解(一):Wi-Fi Display
Pit record of Chmod 2 options in deepin
[vscode] recommended plug-ins
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
CADD课程学习(5)-- 构建靶点已知的化合结构(ChemDraw)