答题模块

test
橙橙楊 5 years ago committed by luffy
parent acf258b3b0
commit ded31e5320
  1. 10
      Query.php
  2. 10
      Question.php
  3. 11
      WasteSorting.php
  4. 325
      admin/Question.php
  5. 2
      api/BaiduImage.php
  6. 5
      api/QueryText.php
  7. 49
      api/QuestionAPI.php
  8. 2
      baidu/BaiduAiRequest.php
  9. 29
      database/DbUtil.php
  10. 90
      database/Query.php
  11. 66
      entity/Answer.php
  12. 2
      entity/Garbage.php
  13. 38
      entity/Menu.php
  14. 80
      entity/Question.php
  15. 8
      head.php
  16. 22
      index.php
  17. 5
      static/js/popper.min.js
  18. 40
      test.php

@ -1,10 +0,0 @@
<?php
namespace admin;
//垃圾分类查询
class Query
{
}

@ -1,10 +0,0 @@
<?php
namespace admin;
//题目管理
class Question
{
}

@ -1,11 +0,0 @@
<?php
namespace admin;
//垃圾分类百科
class WasteSorting
{
}

@ -0,0 +1,325 @@
<?php
namespace admin;
use Answer;
use AnswerQuery;
use DbUtil;
use DoConn;
use Exception;
use mysqli;
use Question;
use QuestionQuery;
require_once "../config.php";
require_once __ROOT__ . "/head.php";
require_once __ROOT__ . "/database/DbUtil.php";
require_once __ROOT__ . "/database/Query.php";
require_once __ROOT__ . "/Log.php";
getMenu("题目管理");
function reponse_with_click($message, $class, $script)
{
echo <<<EOF
<script>
function doClick() {
$script
}
</script>
<div class="container py-5">
<div class="alert $class alert-dismissible fade show col-5 m-auto text-center" role="alert">
<strong>$message</strong>
<button type="button" class="close" data-dismiss="alert" aria-label="Close" onclick="doClick()">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
EOF;
}
function response_with_href($message, $class, $href)
{
reponse_with_click($message, $class, <<<EOF
location.href='$href'
EOF
);
}
function error_res($err)
{
response_with_href($err, "alert-danger", "/admin/Question.php");
}
function info_res($info)
{
response_with_href($info, "alert-info", "/admin/Question.php");
}
function warn_res($warn)
{
response_with_href($warn, "alert-warning", "/admin/Question.php");
}
function warn_res_with_click($warn, $click)
{
reponse_with_click($warn, "alert-warning", $click);
}
if (empty($_POST) && empty($_GET)) {
echo <<<EOF
<!DOCTYPE html>
<html lang="zh">
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip();
var validation = Array.prototype.filter.call($("form.needs-validation"), function(form) {
form.addEventListener('submit', function(event) {
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
$(":radio[name=answer_radio]").click(function() {
$("input[name=right_answer]").val($(this).val())
})
})
function doDel(id) {
if(confirm("确认删除此问题?")){
location.href="/admin/Question.php?action=delete&question_id="+id
}
this.event.preventDefault()
}
</script>
<body>
<ul class="nav nav-pills nav-justified">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#list" role="tab">题目列表</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#add" role="tab">添加题目</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#" onclick="location.href='/'" role="tab">返回首页</a>
</li>
</ul>
<div class="container py-5">
<div class="text-center text-danger">tip:选中题目查看选项</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="list" role="tabpanel" aria-labelledby="v-pills-home-tab">
<div class="list-group d-flex justify-content-center align-items-center w-100">
EOF;
$query = new QuestionQuery();
DbUtil::query("select * from question", $query);
if (empty($query->getQuestionArray())) {
warn_res_with_click("题库暂无题目,需要添加题目", <<<EOF
$('a[href="#add"]').click()
EOF
);
} else {
foreach ($query->getQuestionArray() as $item) {
if ($item instanceof Question) {
$id = $item->getQuestionId();
$title = $item->getQuestionTitle();
echo <<<EOF
<a class="list-group-item list-group-item-action d-flex align-items-center col-6 m-auto justify-content-between" href="/admin/Question.php?action=list&question_id=$id">
$title?
<span class="badge badge-danger badge-pill" data-toggle="tooltip" data-placement="right" title="点击删除" onclick="doDel($id)">X</span>
</a>
EOF;
}
}
}
echo <<<EOF
</div>
</div>
<div id="add" class="tab-pane fade ">
<div class="d-flex justify-content-center align-items-center w-100">
<form class="col-6 needs-validation" novalidate method="post" action="Question.php">
<input type="hidden" name="right_answer">
<input type="hidden" name="action" value="add">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">问题</span>
</div>
<input type="text" class="form-control" placeholder="问题" name="question" required>
<div class="input-group-prepend">
<span class="input-group-text">?</span>
</div>
<div class="invalid-feedback">
问题内容不为空
</div>
</div>
<div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="答案" name="answer[]" required>
<div class="custom-control custom-radio input-group-prepend m-auto" data-toggle="tooltip" data-placement="right" title="选中为正确答案">
<input type="radio" id="customRadio1" name="answer_radio" value="1" class="custom-control-input" required>
<label class="custom-control-label ml-3" for="customRadio1"></label>
<div class="invalid-feedback ml-3">
请选中一个正确答案
</div>
</div>
</div>
</div>
<div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="答案" name="answer[]" required>
<div class="invalid-feedback">
答案内容不为空
</div>
<div class="custom-control custom-radio input-group-prepend m-auto" data-toggle="tooltip" data-placement="right" title="选中为正确答案">
<input type="radio" id="customRadio2" name="answer_radio" value="2" class="custom-control-input" required>
<label class="custom-control-label ml-3" for="customRadio2"></label><div class="invalid-feedback ml-3">
请选中一个正确答案
</div>
</div>
</div>
</div>
<div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="答案" name="answer[]" required>
<div class="invalid-feedback">
答案内容不为空
</div>
<div class="custom-control custom-radio input-group-prepend m-auto" data-toggle="tooltip" data-placement="right" title="选中为正确答案">
<input type="radio" id="customRadio3" name="answer_radio" value="3" class="custom-control-input" required>
<label class="custom-control-label ml-3" for="customRadio3"></label>
<div class="invalid-feedback ml-3">
请选中一个正确答案
</div>
</div>
</div>
</div>
<div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="答案" name="answer[]" required>
<div class="invalid-feedback">
答案内容不为空
</div>
<div class="custom-control custom-radio input-group-prepend m-auto" data-toggle="tooltip" data-placement="right" title="选中为正确答案">
<input type="radio" id="customRadio4" name="answer_radio" value="4" class="custom-control-input" required>
<label class="custom-control-label ml-3" for="customRadio4"></label>
<div class="invalid-feedback ml-3">
请选中一个正确答案
</div>
</div>
</div>
</div>
<button class="btn btn-block btn-info">提交</button>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
EOF;
} else if (isset($_POST["action"]) && $_POST["action"] == "add") {
// 答案数
$answer_count = 4;
if (empty($_POST["question"])) {
error_res("问题不能为空!");
} else if (empty($_POST["answer"])) {
error_res("答案内容不能为空!");
} else if (!is_array($_POST["answer"])) {
error_res("非法答案参数");
} else if (count($_POST["answer"]) != $answer_count) {
error_res("答案数量不等于4个!");
} else if (count(array_unique($_POST["answer"])) != $answer_count) {
error_res("答案不能重复!");
} else if (empty($_POST["right_answer"])) {
error_res("没有正确答案!");
} else {
try {
DbUtil::insert_with_param("insert into question (question_title) values (?)", "s", new class() implements DoConn
{
public function before_close(mysqli $conn)
{
$id = mysqli_insert_id($conn);
foreach ($_POST["answer"] as $answer) {
DbUtil::insert("insert into answer (question_id, answer, is_true) values (?,?,?)", "isi", $id, $answer, array_search($answer, $_POST["answer"]) + 1 == (int)($_POST["right_answer"]));
}
}
}, $_POST["question"]);
info_res("保存成功");
} catch (Exception $e) {
error($e);
error_res("保存异常,请稍后再试或者联系管理员!");
}
}
} else if (isset($_GET["action"]) && $_GET["action"] == "list") {
if (empty($_GET["question_id"])) {
error_res("没有指定问题id,无法查看详情信息!");
} else if (!is_numeric($_GET["question_id"])) {
error_res("问题id不合法");
} else {
$query_result = new AnswerQuery();
DbUtil::query("select * from answer where question_id=?", $query_result, array($_GET["question_id"]));
if (empty($query_result->getAnswerArray())) {
error_res("问题id不合法");
} else {
echo '<div class="container py-5"><div class="col-6 m-auto">';
foreach ($query_result->getAnswerArray() as $item) {
if ($item instanceof Answer) {
$answer = $item->getAnswer();
$is_true = $item->getIsTrue() == 1 ? "checked" : "";
echo <<<EOF
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="答案" value="$answer" readonly>
<div class="custom-control custom-radio input-group-prepend m-auto" data-toggle="tooltip" data-placement="right" title="选中为正确答案">
<input type="radio" id="customRadio1" class="custom-control-input" $is_true disabled>
<label class="custom-control-label ml-3" for="customRadio1"></label>
</div>
</div>
EOF;
} else {
error("类型不匹配");
error_res("操作异常,请联系管理员");
}
}
echo '</div><button class="btn btn-info btn-block col-6 m-auto" onclick="location.href=\'/admin/Question.php\'">返回</button></div>';
}
}
} else if (isset($_GET["action"]) && $_GET["action"] == "delete") {
if (empty($_GET["question_id"])) {
error_res("缺少问题id");
} else if (!is_numeric($_GET["question_id"])) {
error_res("非法参数id");
} else {
try {
DbUtil::delete("DELETE q,a FROM question as q,answer as a WHERE q.question_id=a.question_id and q.question_id=?", "i", (int)$_GET["question_id"]);
info_res("问题删除成功");
} catch (Exception $e) {
error($e);
error_res("操作异常,请联系管理员");
}
}
} else {
\error("非法操作!");
}

@ -43,7 +43,7 @@ function query_waste_soring($image_res)
// 查询token
$token_result = new class() extends AbstractTokenQuery
{
public function bind_param(mysqli_stmt $stmt, array $param)
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
}

@ -13,12 +13,13 @@ class QueryText
{
$garbage_result = new class() extends AbstractGarbageQuery
{
// 参数绑定
public function bind_param(mysqli_stmt $stmt, array $param)
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
if (count($param) > 1) {
$stmt->bind_param(str_repeat("s", count($param)), $param[0], ...array_slice($param, 1));
} else {
} else if (count($param) == 1) {
$stmt->bind_param(str_repeat("s", count($param)), $param[0]);
}

@ -0,0 +1,49 @@
<?php
require_once "../config.php";
require_once __ROOT__ . "/api/JsonResponse.php";
require_once __ROOT__ . "/Log.php";
require_once __ROOT__ . "/database/Query.php";
//题库题目数上限
$max_count = 10;
$q_result = new QuestionQuery();
//随机抽取问题生成题库
DbUtil::query("select * from question order by rand() limit 0," . $max_count, $q_result);
if (empty($q_result->getQuestionArray())) {
json_res(json_encode(array(["status" => false, "msg" => "生成题库失败,题库为空,请联系管理员添加题目"]), JSON_UNESCAPED_UNICODE));
return;
} else {
foreach ($q_result->getQuestionArray() as $querstion_item) {
if ($querstion_item instanceof Question) {
$answer_res = new AnswerQuery();
DbUtil::query("select * from answer where question_id=? order by rand()", $answer_res, array($querstion_item->getQuestionId()));
if (empty($answer_res->getAnswerArray())) {
error("无法查询question_id=" . $querstion_item->getQuestionId() . "答案");
json_res(json_encode(array(["status" => false, "msg" => "生成题库失败,请联系管理员"]), JSON_UNESCAPED_UNICODE));
return;
} else {
$querstion_item->setAnswer($answer_res->getAnswerArray());
foreach ($answer_res->getAnswerArray() as $answer_item) {
if ($answer_item instanceof Answer) {
if ($answer_item->getIsTrue() == "1") {
$querstion_item->setRightAnswer(array_search($answer_item, $answer_res->getAnswerArray()));
break;
}
} else {
error("实体类型不匹配" . var_dump($answer_res[0]));
json_res(json_encode(array(["status" => false, "msg" => "生成题库失败,请联系管理员"]), JSON_UNESCAPED_UNICODE));
return;
}
}
}
} else {
error("实体类型不匹配" . var_dump($querstion_item));
json_res(json_encode(array(["status" => false, "msg" => "生成题库失败,请联系管理员"]), JSON_UNESCAPED_UNICODE));
return;
}
}
json_res(json_encode(array("status" => true, "msg" => "成功创建题库,包含" . count($q_result->getQuestionArray()) . "条题目", "result" => $q_result->getQuestionArray()), JSON_UNESCAPED_UNICODE));
}

@ -37,7 +37,7 @@ class BaiduAiRequest
DbUtil::delete("delete from api_token");
$token = new ApiToken(null, $json_res["refresh_token"], $json_res["expires_in"], null, $json_res["scope"], $json_res["session_key"], $json_res["access_token"], $json_res["session_secret"]);
DbUtil::insert("insert into api_token (refresh_token, expires_in, end_time, scope, session_key, access_token, session_secret) values (?,?,?,?,?,?,?)",
"sisssss", $token->getRefreshToken(), $token->getExpiresIn(), date_format(date_create(date(default_format))->add(date_interval_create_from_date_string($token->getExpiresIn() . " seconds")), default_format), $token->getScope(), $token->getSessionKey(), $token->getAccessToken(), $token->getSessionSecret());
$types = "sisssss", $token->getRefreshToken(), $token->getExpiresIn(), date_format(date_create(date(default_format))->add(date_interval_create_from_date_string($token->getExpiresIn() . " seconds")), default_format), $token->getScope(), $token->getSessionKey(), $token->getAccessToken(), $token->getSessionSecret());
info("token保存成功");
return $token;
}

@ -6,12 +6,19 @@ require_once __ROOT__ . "/Log.php";
interface DoExcute
{
// 参数处理
function bind_param(mysqli_stmt $stmt, array $param);
function bind_param(mysqli_stmt $stmt, array $param = null);
// 执行结果处理
function doResult(mysqli_stmt $stmt);
}
interface DoConn
{
// 连接关闭前处理
function before_close(mysqli $conn);
}
class DbUtil
{
@ -45,12 +52,12 @@ class DbUtil
}
// 插入数据
public static function modify($action, $sql, $types = "", ...$_)
public static function modify($action, $sql, DoConn $do_conn = null, $types = "", ...$_)
{
try {// 创建连接
$conn = self::getConn();
$stmt = $conn->prepare("$sql");//创建一个预定义的对象 ?占位
$stmt = $conn->prepare($sql);//创建一个预定义的对象 ?占位
if (!empty($types)) {
$stmt->bind_param($types, ...$_);// 参数绑定
}
@ -58,6 +65,9 @@ class DbUtil
info($action . $stmt->affected_rows . "条数据");
$stmt->close();
info("执行sql.$sql.成功");
if (!empty($do_conn)) {
$do_conn->before_close($conn);
}
self::closeConn($conn);// 关闭连接
} catch (Exception $e) {
error($action . "数据异常" . $e);
@ -67,24 +77,29 @@ class DbUtil
// 插入数据
public static function insert($sql, $types = "", ...$_)
{
self::modify("插入", $sql, $types, ...$_);
self::modify("插入", $sql, null, $types, ...$_);
}
public static function insert_with_param($sql, $types, $db_conn, ...$_)
{
self::modify("插入", $sql, $db_conn, $types, ...$_);
}
// 更新数据
public static function update($sql, $types = "", ...$_)
{
self::modify("更新", $sql, $types, ...$_);
self::modify("更新", $sql, null, $types, ...$_);
}
// 删除数据
public static function delete($sql, $types = "", ...$_)
{
self::modify("删除", $sql, $types, ...$_);
self::modify("删除", $sql, null, $types, ...$_);
}
//查询数据
public static function query($sql, DoExcute $doExcute, array $param = array())
public static function query($sql, DoExcute $doExcute, array $param = null)
{
try {// 创建连接
$conn = self::getConn();

@ -2,7 +2,9 @@
require_once __ROOT__ . "/entity/ApiToken.php";
require_once __ROOT__ . "/entity/Garbage.php";
require_once __ROOT__ . "/entity/Question.php";
require_once __ROOT__ . "/entity/Answer.php";
require_once __ROOT__ . "/database/DbUtil.php";
//Token查询
abstract class AbstractTokenQuery implements DoExcute
{
@ -86,7 +88,7 @@ function getGarbageQuery($sql, $keyword): AbstractGarbageQuery
{
$garbage_result = new class() extends AbstractGarbageQuery
{
public function bind_param(mysqli_stmt $stmt, array $param)
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
if (count($param) > 1) {
$stmt->bind_param(str_repeat("s", count($param)), $param[0], ...array_slice($param, 1));
@ -100,4 +102,86 @@ function getGarbageQuery($sql, $keyword): AbstractGarbageQuery
DbUtil::query($sql, $garbage_result, $keyword);
return $garbage_result;
}
}
class QuestionQuery implements DoExcute
{
private $question_array = array();
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
}
public function doResult(mysqli_stmt $stmt)
{
$stmt->bind_result($col1, $col2);
while ($stmt->fetch()) {
$q = new Question($col1, $col2);
array_push($this->question_array, $q);
}
}
/**
* @return array
*/
public function getQuestionArray(): array
{
return $this->question_array;
}
}
//查询问题答案
class AnswerQuery implements DoExcute
{
private $answer_array = array();
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
if (!empty($param)) {
$stmt->bind_param("i", $param[0]);
}
}
public function doResult(mysqli_stmt $stmt)
{
$stmt->bind_result($col1, $col2, $col3, $col4);
while ($stmt->fetch()) {
$a = new Answer($col1, $col2, $col3, $col4);
array_push($this->answer_array, $a);
}
}
/**
* @return array
*/
public function getAnswerArray(): array
{
return $this->answer_array;
}
}
//查询问题
class QueryRandQuestion implements DoExcute
{
public function bind_param(mysqli_stmt $stmt, array $param = null)
{
}
public function doResult(mysqli_stmt $stmt)
{
$stmt->bind_result($col1, $col2, $col3, $col4, $col5);
while ($stmt->fetch()) {
}
}
}
;

@ -0,0 +1,66 @@
<?php
//答案类
class Answer implements JsonSerializable
{
private $answer_id;
private $question_id;
private $answer;
private $is_true;
/**
* Answer constructor.
* @param $answer_id
* @param $question_id
* @param $answer
* @param $is_true
*/
public function __construct($answer_id, $question_id, $answer, $is_true)
{
$this->answer_id = $answer_id;
$this->question_id = $question_id;
$this->answer = $answer;
$this->is_true = $is_true;
}
/**
* @return mixed
*/
public function getAnswerId()
{
return $this->answer_id;
}
/**
* @return mixed
*/
public function getQuestionId()
{
return $this->question_id;
}
/**
* @return mixed
*/
public function getAnswer()
{
return $this->answer;
}
/**
* @return mixed
*/
public function getIsTrue()
{
return $this->is_true;
}
public function jsonSerialize()
{
$data = [];
foreach ($this as $key => $val) {
if ($val !== null) $data[$key] = $val;
}
return $data;
}
}

@ -1,5 +1,4 @@
<?php
//垃圾分类
class Garbage implements JsonSerializable
{
@ -55,7 +54,6 @@ class Garbage implements JsonSerializable
return $this->update_at;
}
public function jsonSerialize()
{
$data = [];

@ -0,0 +1,38 @@
<?php
//菜单管理
class Menu
{
private $name;
private $interface;
/**
* Menu constructor.
* @param $name
* @param $interface
*/
public function __construct($name, $interface)
{
$this->name = $name;
$this->interface = $interface;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @return mixed
*/
public function getInterface()
{
return $this->interface;
}
}

@ -0,0 +1,80 @@
<?php
//问题类
class Question implements JsonSerializable
{
private $question_id;
private $question_title;
private $answer = array();
private $right_answer;
/**
* Question constructor.
* @param $question_id
* @param $question_title
*/
public function __construct($question_id, $question_title)
{
$this->question_id = $question_id;
$this->question_title = $question_title;
}
/**
* @return mixed
*/
public function getQuestionId()
{
return $this->question_id;
}
/**
* @return mixed
*/
public function getQuestionTitle()
{
return $this->question_title;
}
/**
* @param mixed $question_id
*/
public function setQuestionId($question_id): void
{
$this->question_id = $question_id;
}
/**
* @param mixed $question_title
*/
public function setQuestionTitle($question_title): void
{
$this->question_title = $question_title;
}
public function jsonSerialize()
{
$data = [];
foreach ($this as $key => $val) {
if ($val !== null) $data[$key] = $val;
}
return $data;
}
/**
* @param array $answer
*/
public function setAnswer(array $answer): void
{
$this->answer = $answer;
}
/**
* @param mixed $right_answer
*/
public function setRightAnswer($right_answer): void
{
$this->right_answer = $right_answer;
}
}

@ -5,9 +5,11 @@ function getMenu($menu)
echo <<<EOF
<head>
<title>$menu</title>
<link rel="stylesheet" type="text/css" href="static/css/bootstrap.min.css">
<script src="static/js/jquery-3.4.1.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
<script src="/static/js/popper.min.js"></script>
<script src="/static/js/jquery-3.4.1.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
</head>
EOF;
}

@ -1,7 +1,12 @@
<?php
$menus = array("API" => "百度API配置", "WasteSorting" => "垃圾分类管理", "Question" => "题目管理");
require_once "config.php";
require_once __ROOT__ . "/head.php";
require_once __ROOT__ . "/entity/Menu.php";
//菜单信息
$menus = array("API" => new Menu("百度API配置", "/admin/ApiConfig.php"), new Menu("垃圾分类", "/admin/WasteSorting.php"), new Menu("题目管理", "/admin/Question.php"));
getMenu("后台管理");
@ -14,16 +19,19 @@ echo <<<EOF
<ul class="navbar-nav">
EOF;
foreach ($menus as $key => $value) {
echo <<<EOF
<li class="nav-item">
<a class="nav-link" href="#">$value</a>
</li>
EOF;
if ($value instanceof Menu) {
echo '<li class="nav-item">';
echo '<a class="nav-link" href="' . $value->getInterface() . '">' . $value->getName() . '</a>';
echo '</li>';
}
}
echo <<<EOF
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true"><span style="color: black">欢迎管理员<b style="color: red">luffy</b>登陆</span></a>
</li>
</ul>
</div>

File diff suppressed because one or more lines are too long

@ -1,23 +1,29 @@
<?php
include "config.php";
include __ROOT__ . "/database/DbUtil.php";
require_once "config.php";
require_once __ROOT__ . "/database/DbUtil.php";
require_once __ROOT__ . "/entity/Question.php";
require_once __ROOT__ . "/entity/Answer.php";
echo <<<EOF
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>
//echo <<<EOF
//<html>
//<head>
//<meta charset="utf-8">
//<title>菜鸟教程(runoob.com)</title>
//</head>
//<body>
//
//<form action="/api/BaiduImage.php" method="post" enctype="multipart/form-data">
// <label for="file">文件名:</label>
// <input type="file" name="file" id="file"><br>
// <input type="submit" name="submit" value="提交">
//</form>
//
//</body>
//</html>
//EOF;
var_dump(array_search(new Answer(1, 2, 3, 4), array(new Answer(4, 5, 6, 7), new Answer(2, 2, 3, 4))));
<form action="/api/BaiduImage.php" method="post" enctype="multipart/form-data">
<label for="file">文件名:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>
EOF;

Loading…
Cancel
Save