• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getStatusCodeMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getStatusCodeMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP getStatusCodeMessage函数的具体用法?PHP getStatusCodeMessage怎么用?PHP getStatusCodeMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getStatusCodeMessage函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: sendResponse

function sendResponse($status, $body = '', $content_type = 'text/html')
{
    $status_header = 'HTTP/1.1 ' . $status . ' ' . getStatusCodeMessage($status);
    header($status_header);
    header('Content-type: ' . $content_type);
    echo $body;
}
开发者ID:ad1269,项目名称:GeoChat,代码行数:7,代码来源:Decrypt.php


示例2: sendResponse

function sendResponse($status = 200, $body = '', $content_type = 'application/json')
{
    $status_header = 'HTTP/1.1 ' . $status . ' ' . getStatusCodeMessage($status);
    header($status_header);
    header('Content-type: ' . $content_type);
    echo $body;
}
开发者ID:sheepcao,项目名称:dota,代码行数:7,代码来源:note.php


示例3: sendResponse

 public static function sendResponse($status = 200, $body = '', $content_type = 'text/html')
 {
     header($status . ": " . getStatusCodeMessage(200));
     header('Content-Type: $content_type; charset=utf8');
     //header('Access-Control-Allow-Origin: http://www.example.com/');
     //header('Access-Control-Max-Age: 3628800');
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
     header("Status: 404 Not Found");
     print $body;
 }
开发者ID:mzeena,项目名称:homer,代码行数:12,代码来源:restutils.php


示例4: validate_requests

function validate_requests($api_token = '')
{
    global $status;
    $sql = "SELECT request_count, last_login FROM `api_users` WHERE `token` = '" . $api_token . "'";
    $select = query($sql);
    $login = getRowList($select);
    if (!empty($login)) {
        $now = date('Y-m-d');
        // count API requests per day
        if ($login->last_login == $now) {
            $sql = "UPDATE `api_users` SET \n                `request_count` = request_count+1,\n                WHERE `token` = '" . $api_token . "'";
        } else {
            $sql = "UPDATE `api_users` SET \n                `request_count` = 1,  \n                `last_login` = CURDATE()\n                WHERE `token` = '" . $api_token . "'";
        }
        $update = query($sql);
    } else {
        // create some error code/message
        $status['code'] = 400;
        $status['status'] = getStatusCodeMessage($status['code']);
    }
    // handle back the number of requests per day
    return $login->request_count;
}
开发者ID:namaris,项目名称:Can_Pages,代码行数:23,代码来源:rest.class.php


示例5: getRowList

        // return database property results
        $sql = "SELECT DISTINCT reservation_title,\n                    reservation_guest_name, reservation_guest_adress, reservation_guest_city,\n                    reservation_guest_email, reservation_guest_phone \n                    FROM reservations WHERE reservation_guest_name = '" . $_SESSION['reservation_guest_name'] . "' \n                    GROUP BY reservation_guest_name";
        $data = getRowList(query($sql));
        // create some status code/message
        if (!empty($data)) {
            $status['code'] = 200;
            $status['status'] = getStatusCodeMessage($status['code']);
        } else {
            $status['code'] = 204;
            $status['status'] = getStatusCodeMessage($status['code']);
        }
    }
} else {
    // create some error code/message
    $status['code'] = 401;
    $status['status'] = getStatusCodeMessage($status['code']);
}
$result['status'] = $status;
$result['response']['details'] = $data;
if ($status['code'] != 400 && $request_count < $max_requests) {
    $data = querySQL('reservation_history');
}
$result['response']['history'] = $data;
if ($status['code'] != 400 && $request_count < $max_requests) {
    // return database property results
    $data = querySQL('reservation_last_visit');
}
$result['response']['last_visit'] = $data;
if ($status['code'] != 400 && $request_count < $max_requests) {
    // return database property results
    $data = querySQL('reservation_visits');
开发者ID:namaris,项目名称:Can_Pages,代码行数:31,代码来源:json.php


示例6: sendResponse

function sendResponse($status = 200, $body = '', $content_type = 'text/html')
{
    $status_header = 'HTTP/1.1 ' . $status . ' ' . getStatusCodeMessage($status);
    // set the status
    header($status_header);
    // set the content type
    header('Content-type: ' . $content_type);
    // pages with body are easy
    if ($body != '') {
        // send the body
        echo $body;
        exit;
    } else {
        // create some body messages
        $message = '';
        // this is purely optional, but makes the pages a little nicer to read
        // for your users.  Since you won't likely send a lot of different status codes,
        // this also shouldn't be too ponderous to maintain
        switch ($status) {
            case 401:
                $message = 'You must be authorized to view this page.';
                break;
            case 404:
                $message = 'The requested URL ' . $_SERVER['REQUEST_URI'] . ' was not found.';
                break;
            case 500:
                $message = 'The server encountered an error processing your request.';
                break;
            case 501:
                $message = 'The requested method is not implemented.';
                break;
        }
        // servers don't always have a signature turned on (this is an apache directive "ServerSignature On")
        $signature = $_SERVER['SERVER_SIGNATURE'] == '' ? $_SERVER['SERVER_SOFTWARE'] . ' Server at ' . $_SERVER['SERVER_NAME'] . ' Port ' . $_SERVER['SERVER_PORT'] : $_SERVER['SERVER_SIGNATURE'];
        $body = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
					<html>
						<head>
							<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
							<title>' . $status . ' ' . getStatusCodeMessage($status) . '</title>
						</head>
						<body>
							<h1>' . getStatusCodeMessage($status) . '</h1>
							<p>' . $message . '</p>
							<hr>
							<address>' . $signature . '</address>
						</body>
					</html>';
        echo $body;
        exit;
    }
}
开发者ID:Eworm,项目名称:BIS,代码行数:51,代码来源:index.php



注:本文中的getStatusCodeMessage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getStoreJoininImageUrl函数代码示例发布时间:2022-05-15
下一篇:
PHP getStatus函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap