init
This commit is contained in:
commit
22d7ae5aa7
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.vscode/
|
||||
*.htaccess
|
||||
track.php
|
11
api.php
Normal file
11
api.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
//设置json格式头部
|
||||
header('Content-type: application/json');
|
||||
//载入数据库文件
|
||||
require("data.php");
|
||||
//查询随机一条记录
|
||||
$sql = "SELECT * FROM soul ORDER BY RAND() LIMIT 1";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
$row = mysqli_fetch_assoc($result);
|
||||
//输出json
|
||||
echo json_encode(array('code' => 1, 'data' => $row['title']));
|
7
css/bootstrap.min.css
vendored
Normal file
7
css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
9174
css/min.css
Normal file
9174
css/min.css
Normal file
File diff suppressed because it is too large
Load Diff
4
data.php
Normal file
4
data.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
$conn = mysqli_connect("localhost", "nows", "nows11"); //连接数据库地址、用户名、密码
|
||||
mysqli_query($conn, "set names 'utf8'"); //数据库编码
|
||||
mysqli_select_db($conn, "nows"); //数据库名称
|
BIN
img/logo.png
Normal file
BIN
img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
76
index.php
Normal file
76
index.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
ob_start();
|
||||
session_start();
|
||||
require("data.php");
|
||||
require("track.php");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
|
||||
<title></title>
|
||||
<meta name="description" content="">
|
||||
<meta name="keywords" content="">
|
||||
<meta name="author" content="" />
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" id="page_favionc">
|
||||
<link href="./css/min.css" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="top-wrap" style="position: absolute; top: 1vh;width: 100%;z-index: 999">
|
||||
<div class="container">
|
||||
<div class="row" style="margin-top: 30px;">
|
||||
<div class="col">
|
||||
<img src="./img/logo.png">
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="float-right" style="padding-top: 0px;">
|
||||
<a class="btn btn-primary btn-filled btn-xs" href="https://git.loliquq.cn/earthjasonlin/nows">开源</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-wrapper" style="position: relative; top: -6vh;">
|
||||
<div class="container main-sentence justify-content-center text-center">
|
||||
<?php
|
||||
//查询随机一条记录
|
||||
$sql = "SELECT * FROM soul ORDER BY RAND() LIMIT 1";
|
||||
$result = mysqli_query($conn, $sql);
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
?>
|
||||
<div id="sentence" style="font-size: 2rem;">
|
||||
<?php echo $row["title"] ?>
|
||||
</div>
|
||||
<?php
|
||||
if ($row["author"] != NULL) {
|
||||
?>
|
||||
<div id="author" style="font-size: 1.5rem;">
|
||||
-<?php echo $row["author"] ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="foot-1" style="position: absolute; bottom: 7vh;width: 100%;">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<p class="lead text">截屏分享朋友</p>
|
||||
<span class="btn btn-primary btn-filled btn-xs"><a class="btn btn-primary btn-filled btn-xs" href="/">再来一句</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
52
soul.sql
Normal file
52
soul.sql
Normal file
@ -0,0 +1,52 @@
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET AUTOCOMMIT = 0;
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+08:00";
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
|
||||
;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
|
||||
;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
|
||||
;
|
||||
/*!40101 SET NAMES utf8mb4 */
|
||||
;
|
||||
--
|
||||
-- 数据库: `nows`
|
||||
--
|
||||
|
||||
-- --------------------------------------------------------
|
||||
--
|
||||
-- 表的结构 `soul`
|
||||
--
|
||||
|
||||
CREATE TABLE `soul` (
|
||||
`id` int(11) NOT NULL,
|
||||
`title` varchar(300) NOT NULL,
|
||||
`author` varchar(30)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
||||
--
|
||||
-- 转储表的索引
|
||||
--
|
||||
|
||||
--
|
||||
-- 表的索引 `soul`
|
||||
--
|
||||
ALTER TABLE `soul`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
--
|
||||
-- 在导出的表使用AUTO_INCREMENT
|
||||
--
|
||||
|
||||
--
|
||||
-- 使用表AUTO_INCREMENT `soul`
|
||||
--
|
||||
ALTER TABLE `soul`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
AUTO_INCREMENT = 1;
|
||||
COMMIT;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
|
||||
;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
|
||||
;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
|
||||
;
|
Loading…
x
Reference in New Issue
Block a user