本文整理汇总了PHP中Courses::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::update方法的具体用法?PHP Courses::update怎么用?PHP Courses::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public static function update($id, $data)
{
session_start();
$headers = apache_request_headers();
$token = $headers['X-Auth-Token'];
if (!$headers['X-Auth-Token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
} else {
if ($token != $_SESSION['form_token']) {
header('Invalid CSRF Token', true, 401);
return print json_encode(array('success' => false, 'status' => 400, 'msg' => 'Invalid CSRF Token / Bad Request / Unauthorized ... Please Login again'), JSON_PRETTY_PRINT);
} else {
if (!isset($data['coursecode']) && empty($data['coursecode'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Course Code is required'), JSON_PRETTY_PRINT);
die;
} else {
if (!isset($data['coursename']) && empty($data['coursename'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Course Description is required'), JSON_PRETTY_PRINT);
die;
} else {
if (!isset($data['passing_score']) && empty($data['passing_score'])) {
return print json_encode(array('success' => false, 'status' => 200, 'msg' => 'Passing Score Limit is required'), JSON_PRETTY_PRINT);
die;
} else {
$var = ["coursecode" => $data['coursecode'], "coursename" => $data['coursename'], "passing_score" => $data['passing_score']];
Courses::update($id, $var);
}
}
}
}
}
}