当前位置:网站首页>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
边栏推荐
- UNIX commands often used in work
- DataGrid offline installation of database driver
- [node] NVM version management tool
- QT small case "addition calculator"
- When jupyter notebook is encountered, erroe appears in the name and is not output after running, but an empty line of code is added downward, and [] is empty
- Idea common settings
- 【Node】nvm 版本管理工具
- deepin 20 kivy unable to get a window, abort
- Set theory of Discrete Mathematics (I)
- Basic series of SHEL script (III) for while loop
猜你喜欢
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
Line test -- data analysis -- FB -- teacher Gao Zhao
Idea to view the source code of jar package and some shortcut keys (necessary for reading the source code)
2022 PMP project management examination agile knowledge points (7)
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
Deepin get file (folder) list
Ugnx12.0 initialization crash, initialization error (-15)
[software testing] 03 -- overview of software testing
Self summary of college life - freshman
PostMessage communication
随机推荐
Detailed explanation of miracast Technology (I): Wi Fi display
Simple operation of running water lamp (keil5)
Import CV2 prompt importerror: libgl so. 1: Cannot open shared object file: no such file or directory
Idea to view the source code of jar package and some shortcut keys (necessary for reading the source code)
I 用c I 实现队列
Mathematical analysis_ Notes_ Chapter 8: multiple integral
The SQL implementation has multiple records with the same ID, and the latest one is taken
Machine learning Seaborn visualization
【idea】Could not autowire. No beans of xxx type found
Set theory of Discrete Mathematics (I)
目标检测系列——Faster R-CNN原理详解
NPM and package common commands
Oracle code use
Use of Pai platform
[software testing] 02 -- software defect management
Basic series of SHEL script (I) variables
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Rough notes of C language (1)
2022 PMP project management examination agile knowledge points (7)
The problem of configuring opencv in qt5.13.2 is solved in detail