当前位置:网站首页>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
边栏推荐
- I can't stand the common annotations of idea anymore
- How can Oracle SQL statements modify fields that are not allowed to be null to allow nulls?
- CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
- [idea] efficient plug-in save actions to improve your work efficiency
- Deepin, help ('command ') output saved to file
- Miracast技术详解(一):Wi-Fi Display
- Use go language to read TXT file and write it into Excel
- Tshydro tool
- Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
- Idea common settings
猜你喜欢
Delayqueue usage and scenarios of delay queue
Machine learning Seaborn visualization
611. Number of effective triangles
(tool use) how to make the system automatically match and associate to database fields by importing MySQL from idea and writing SQL statements
Self summary of college life - freshman
M2DGR 多源多场景 地面机器人SLAM数据集
And let's play dynamic proxy (extreme depth version)
The mutual realization of C L stack and queue in I
[idea] efficient plug-in save actions to improve your work efficiency
SOC_ SD_ CMD_ FSM
随机推荐
Idea to view the source code of jar package and some shortcut keys (necessary for reading the source code)
R language learning notes 1
使用go语言读取txt文件写入excel中
The SQL implementation has multiple records with the same ID, and the latest one is taken
Basic series of SHEL script (I) variables
What does soda ash do?
Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘
selenium 元素定位
I 用c I 实现队列
Selenium element positioning
DataGrid offline installation of database driver
What if the DataGrid cannot see the table after connecting to the database
2022.06.27_每日一题
How can Oracle SQL statements modify fields that are not allowed to be null to allow nulls?
Simple use of timeunit
Negative number storage and type conversion in programs
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
Detour of Tkinter picture scaling
大学生活的自我总结-大一
CADD课程学习(6)-- 获得已有的虚拟化合物库(Drugbank、ZINC)