本文整理汇总了PHP中Exercise::Blank方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::Blank方法的具体用法?PHP Exercise::Blank怎么用?PHP Exercise::Blank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::Blank方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
include_once '../Model/exercise.php';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$method = $_SERVER['REQUEST_METHOD'];
$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'web';
$view = null;
switch ($action . '_' . $method) {
case 'create_GET':
$model = Exercise::Blank();
$view = "exercise/edit.php";
break;
case 'save_POST':
$sub_action = empty($_REQUEST['Exercise_id']) ? 'Created_at' : 'Updated_at';
$errors = Exercise::Validate($_REQUEST);
if (!$errors) {
$errors = Exercise::Save($_REQUEST);
}
if (!$errors) {
if ($format == 'json') {
header("Location: ?action=edit&format=json&id={$_REQUEST['Exercise_id']}");
} else {
header("Location: ?sub_action={$sub_action}&id={$_REQUEST['Exercise_id']}");
}
die;
} else {
//my_print($errors);
$model = $_REQUEST;
$view = "exercise/edit.php";
}
break;
示例2: isset
<?php
include_once '../Model/exercise.php';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$method = $_SERVER['REQUEST_METHOD'];
$format = isset($_REQUEST['format']) ? $_REQUEST['format'] : 'web';
$view = null;
switch ($action . '_' . $method) {
case 'create_GET':
$exercises = Exercise::Blank();
$view = "exercises/edit.php";
break;
case 'save_POST':
$sub_action = empty($_REQUEST['id']) ? 'created' : 'updated';
$errors = Exercise::Validate($_REQUEST);
if (!$errors) {
$errors = Exercise::Save($_REQUEST);
}
if (!$errors) {
if ($format == 'json') {
header("Location: ?action=edit&format=json&id={$_REQUEST['id']}");
} else {
header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}");
}
die;
} else {
$exercises = $_REQUEST;
$view = "exercises/edit.php";
}
break;
case 'edit_GET':