当前位置:网站首页>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
边栏推荐
- Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
- [idea] efficient plug-in save actions to improve your work efficiency
- M2dgr slam data set of multi-source and multi scene ground robot
- The folder directly enters CMD mode, with the same folder location
- ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
- D2L installation
- Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
- (tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
- Cookie operation
- 氫氧化鈉是什麼?
猜你喜欢
The number of occurrences of numbers in the offer 56 array (XOR)
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
HDU1232 畅通工程(并查集)
第 2 章:小试牛刀,实现一个简单的Bean容器
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
Negative number storage and type conversion in programs
The problem of configuring opencv in qt5.13.2 is solved in detail
Today, share the wonderful and beautiful theme of idea + website address
随机推荐
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
Basic knowledge of public security -- FB
Light up the running light, rough notes for beginners (1)
Idea common settings
Deepin, help ('command ') output saved to file
Hdu1232 unimpeded project (and collection)
Today, share the wonderful and beautiful theme of idea + website address
并查集理论讲解和代码实现
Close of office 365 reading
GBK error in web page Chinese display (print, etc.), solution
苏打粉是什么?
Clickhouse database installation deployment and remote IP access
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
2022.06.27_ One question per day
CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)
Chapter 2: try to implement a simple bean container
The problem of configuring opencv in qt5.13.2 is solved in detail
Using GEE plug-in in QGIS