本文整理匯總了PHP中Problem::getInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Problem::getInfo方法的具體用法?PHP Problem::getInfo怎麽用?PHP Problem::getInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Problem
的用法示例。
在下文中一共展示了Problem::getInfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Problem
if (isset($mo_request[1]) && is_numeric($mo_request[1])) {
$problem = new Problem($mo_request[1]);
$problem->load();
if (!$problem->getPID()) {
require_once $mo_theme_floder . '404.php';
}
if (isset($_POST['lang']) && isset($_POST['code']) && $user->getUID()) {
// 提交solution
if (!b_check_code()) {
echo '提交錯誤!請檢查格式以及是否已經登錄!';
} else {
$new_sid = mo_add_new_solution($mo_request[1], $_POST['lang'], $_POST['code']);
echo '提交成功!<a href="/?r=solution/' . $new_sid . '">點此</a>查看詳情!';
}
}
echo '<h2>' . $problem->getInfo('title') . '</h2>';
echo '<em>標簽:' . $problem->getInfo('tag') . '<br>';
echo '時間限製:' . $problem->getInfo('time_limit') . 'MS 內存限製:' . $problem->getInfo('memory_limit') . 'MB</em>';
echo '<h3>問題描述</h3>';
echo $problem->getInfo('description');
echo '<br>提交人數:' . $problem->getInfo('try') . ' AC人數:' . $problem->getInfo('solved') . '<br>';
echo '<h3>提交代碼</h3>';
echo '<form name="form1" method="post" action="">
語言:
<p>
<label>
<input name="lang" type="radio" required id="lang-1" value="1" checked>
C/C++</label>
</p>
<p>代碼:</p>
<p>
示例2: die
if (!$app->user->isLogin()) {
die('<center><a href=\'admin/status.php?action=login&url=../index.php\'>Please login or register first!</a></center>');
}
if ($app->user->getPower() != 0) {
die('<center><a href=\'admin/status.php?action=login&url=../index.php\'>Please login or register first!</a></center>');
}
if (isset($_GET['action'])) {
if ($_GET['action'] == "delete") {
$db = new MySQL();
$db->from("Problem")->where("`id`='" . intval($_GET['id']) . "'")->delete();
}
}
if (isset($_POST['submit'])) {
require_once "classes/Problem.php";
$pro = new Problem($_POST['pid'], $_POST['oj']);
$pro_info = $pro->getInfo();
$db = new MySQL();
$num = $db->from("Problem")->select("max(cast(id as signed))")->fetch_one();
//Just a hack for PHP <= 5.3
$db->value(array('id' => intval($num['max(cast(id as signed))']) + 1, 'pid' => $_POST['pid'], 'title' => get_magic_quotes_gpc() ? $pro_info['title'] : addslashes($pro_info['title']), 'oj' => $_POST['oj']))->insert("Problem");
$alert = "Problem " . $pro_info['title'] . " added !";
}
if (isset($_POST['time'])) {
$app->setting->set("startTime", strtotime($_POST['stime']));
$app->setting->set("endTime", strtotime($_POST['etime']));
$alert = "Start at " . $_POST['stime'] . " and end at " . $_POST['etime'];
}
if (isset($_POST['clean'])) {
$db = new MySQL();
$db->from("Problem")->delete();
$db->from("Record")->delete();