<form method="post"> <label>Введите текст А </label></br> <textarea name="txt1"><? $a;?></textarea></br> <input type="submit" name="submit" value="Найти слова"></br> </form> <?php function getTop3($a) { $a = $_POST["txt1"]; $b = explode(" ", $a); foreach ($b as $v) { $count = strlen($v); echo $count . "</br>"; $arr[] = $count; print_r($arr); $max = max($arr); echo $max; } } if ($_POST['submit']) { getTop3($a); }
date_default_timezone_set("Asia/Shanghai"); session_start(); class MyDB extends SQLite3 { function __construct() { $this->open('../../fitdayDB.db'); } } $db = new MyDB(); if (!$db) { echo $db->lastErrorMsg(); } $type = $_GET['type']; if ($type == "top3") { getTop3($db); } if ($type == "rank") { getRank($db); } if ($type == "timeline") { $pagenum = $_GET['page']; getPageN($pagenum, $db); } function getRank($db) { $userid = $_SESSION['users']; $nowdate = date('Y-m-d', time()); $datetime = strtotime(date("Y-m-d", time())); //获取当前日期并转换成时间戳 $tomorrow = date('Y-m-d', $datetime + 86400);
<link href="/assets/stylesheets/bootstrap.min.css" rel="stylesheet"> <link href="/assets/stylesheets/add.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <!-- PHP ================== --> <?php include_once "/var/www/php/sql_connect.php"; $leaders = getTop3(); $log = getGameLog(); ?> <style> .leader{ width:300px; height: 120px; background-color: #222; border: 1px solid #555; border-radius: 3px; margin-top: 5px; margin-bottom: 2%; margin-right: auto; margin-left: auto;