本文整理汇总了PHP中send_http_status函数的典型用法代码示例。如果您正苦于以下问题:PHP send_http_status函数的具体用法?PHP send_http_status怎么用?PHP send_http_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_http_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _empty
public function _empty()
{
$this->redirect('index/index');
exit;
send_http_status(404);
$this->display(TMPL_PATH . '404.html');
}
示例2: _denyDirectory
/**
* 禁止路径
*
* @author mrmsl <msl-138@163.com>
* @date 2012-07-10 15:40:01
* @lastmodify 2013-01-22 10:51:46 by mrmsl
*
* @param string $path 待检测路径
*
* @return void 无返回值
*/
private function _denyDirectory($path)
{
if (false !== strpos($path, '..')) {
$this->_model->addLog(L('LIST_DIRECTORY_FORBIDDEN') . PACKER_JS_PATH . $path, LOG_TYPE_INVALID_PARAM);
send_http_status(HTTP_STATUS_SERVER_ERROR);
$this->_ajaxReturn(L('LIST_DIRECTORY_FORBIDDEN') . PACKER_JS_PATH . $path);
}
}
示例3: _denyDirectory
/**
* 禁止路径
*
* @author mrmsl <msl-138@163.com>
* @date 2012-07-10 15:40:01
*
* @param string $path 待检测路径
*
* @return void 无返回值
*/
private function _denyDirectory($path)
{
if (false !== strpos($path, '..')) {
$log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . L('LIST_DIRECTORY_FORBIDDEN') . PACKER_JS_PATH . $path;
trigger_error($log, E_USER_ERROR);
send_http_status(HTTP_STATUS_SERVER_ERROR);
$this->_ajaxReturn(true, L('LIST_DIRECTORY_FORBIDDEN') . PACKER_JS_PATH . $path);
}
}
示例4: _404
protected function _404($url = '')
{
if ($url) {
redirect($url);
} else {
send_http_status(404);
$this->display(TMPL_PATH . '404.html');
exit;
}
}
示例5: _productNotExist
protected function _productNotExist($url = '')
{
if ($url) {
redirect($url);
} else {
send_http_status(404);
$this->display('Public/productNotExist');
exit;
}
}
示例6: _empty
/**
* 空操作,用于输出404页面
*/
public function _empty()
{
//针对后台ajax请求特殊处理
if (!IS_AJAX) {
send_http_status(404);
}
if (IS_AJAX && IS_POST) {
$data = array('info' => '请求地址不存在或已经删除', 'status' => 0, 'total' => 0, 'rows' => array());
$this->ajaxReturn($data);
} else {
$this->display('Common:404');
}
}
示例7: _initialize
public function _initialize()
{
parent::_initialize();
$this->Config = F("Member_Config");
if (!$this->Config) {
$setting = M("Module")->where(array("module" => "Member"))->getField("setting");
if (!$setting) {
//获取不到配置,记录错误日志
$msg = "获取不到相关配置,QQ互联无法进行!";
if (APP_DEBUG) {
// 模块不存在 抛出异常
throw_exception($msg);
} else {
if (C('LOG_EXCEPTION_RECORD')) {
Log::write($msg);
}
send_http_status(404);
exit;
}
}
$this->Config = unserialize($setting);
F("Member_Config", $this->Config);
}
$this->qq_akey = $this->Config['qq_akey'];
$this->qq_skey = $this->Config['qq_skey'];
if (!$this->qq_akey || !$this->qq_skey) {
$msg = "没有进行QQ互联的相关配置,请配置后在继续使用!";
if (APP_DEBUG) {
// 模块不存在 抛出异常
throw_exception($msg);
} else {
if (C('LOG_EXCEPTION_RECORD')) {
Log::write($msg);
}
send_http_status(404);
exit;
}
}
//跳转时间
$this->assign("waitSecond", 2000);
}
示例8: prohibitAccess
/**
* 禁止非法访问
*/
private function prohibitAccess()
{
if (!in_array(MODULE_NAME, C('MODULE_ALLOW_LIST'))) {
if (APP_DEBUG) {
E('该模块没有安装,无法进行访问!');
} else {
send_http_status(400);
exit;
}
}
$config = cache('Config');
if (MODULE_NAME == 'Admin' && isModuleInstall('Domains') && $config['domainaccess']) {
$Module_Domains_list = cache('Module_Domains_list');
$http_host = strtolower($_SERVER['HTTP_HOST']);
$domain = explode('|', $Module_Domains_list['Admin']);
if ($Module_Domains_list['Admin'] && !in_array($http_host, $domain)) {
send_http_status(404);
exit;
}
}
}
示例9: dispatch
//.........这里部分代码省略.........
if (is_file(MODULE_PATH . 'Conf/config' . CONF_EXT)) {
C(load_config(MODULE_PATH . 'Conf/config' . CONF_EXT));
}
// 加载应用模式对应的配置文件
if ('common' != APP_MODE && is_file(MODULE_PATH . 'Conf/config_' . APP_MODE . CONF_EXT)) {
C(load_config(MODULE_PATH . 'Conf/config_' . APP_MODE . CONF_EXT));
}
// 当前应用状态对应的配置文件
if (APP_STATUS && is_file(MODULE_PATH . 'Conf/' . APP_STATUS . CONF_EXT)) {
C(load_config(MODULE_PATH . 'Conf/' . APP_STATUS . CONF_EXT));
}
// 加载模块别名定义
if (is_file(MODULE_PATH . 'Conf/alias.php')) {
Think::addMap(include MODULE_PATH . 'Conf/alias.php');
}
// 加载模块tags文件定义
if (is_file(MODULE_PATH . 'Conf/tags.php')) {
Hook::import(include MODULE_PATH . 'Conf/tags.php');
}
// 加载模块函数文件
if (is_file(MODULE_PATH . 'Common/function.php')) {
include MODULE_PATH . 'Common/function.php';
}
// 加载模块的扩展配置文件
load_ext_file(MODULE_PATH);
} else {
E(L('_MODULE_NOT_EXIST_') . ':' . MODULE_NAME);
}
if (!defined('__APP__')) {
$urlMode = C('URL_MODEL');
if ($urlMode == URL_COMPAT) {
// 兼容模式判断
define('PHP_FILE', _PHP_FILE_ . '?' . $varPath . '=');
} elseif ($urlMode == URL_REWRITE) {
$url = dirname(_PHP_FILE_);
if ($url == '/' || $url == '\\') {
$url = '';
}
define('PHP_FILE', $url);
} else {
define('PHP_FILE', _PHP_FILE_);
}
// 当前应用地址
define('__APP__', strip_tags(PHP_FILE));
}
// 模块URL地址
$moduleName = defined('MODULE_ALIAS') ? MODULE_ALIAS : MODULE_NAME;
define('__MODULE__', defined('BIND_MODULE') || !C('MULTI_MODULE') ? __APP__ : __APP__ . '/' . ($urlCase ? strtolower($moduleName) : $moduleName));
if ('' != $_SERVER['PATH_INFO'] && (!C('URL_ROUTER_ON') || !Route::check())) {
// 检测路由规则 如果没有则按默认规则调度URL
Hook::listen('path_info');
// 检查禁止访问的URL后缀
if (C('URL_DENY_SUFFIX') && preg_match('/\\.(' . trim(C('URL_DENY_SUFFIX'), '.') . ')$/i', $_SERVER['PATH_INFO'])) {
send_http_status(404);
exit;
}
// 去除URL后缀
$_SERVER['PATH_INFO'] = preg_replace(C('URL_HTML_SUFFIX') ? '/\\.(' . trim(C('URL_HTML_SUFFIX'), '.') . ')$/i' : '/\\.' . __EXT__ . '$/i', '', $_SERVER['PATH_INFO']);
$depr = C('URL_PATHINFO_DEPR');
$paths = explode($depr, trim($_SERVER['PATH_INFO'], $depr));
if (!defined('BIND_CONTROLLER')) {
// 获取控制器
if (C('CONTROLLER_LEVEL') > 1) {
// 控制器层次
$_GET[$varController] = implode('/', array_slice($paths, 0, C('CONTROLLER_LEVEL')));
$paths = array_slice($paths, C('CONTROLLER_LEVEL'));
} else {
$_GET[$varController] = array_shift($paths);
}
}
// 获取操作
if (!defined('BIND_ACTION')) {
$_GET[$varAction] = array_shift($paths);
}
// 解析剩余的URL参数
$var = array();
if (C('URL_PARAMS_BIND') && 1 == C('URL_PARAMS_BIND_TYPE')) {
// URL参数按顺序绑定变量
$var = $paths;
} else {
preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function ($match) use(&$var) {
$var[$match[1]] = strip_tags($match[2]);
}, implode('/', $paths));
}
$_GET = array_merge($var, $_GET);
}
// 获取控制器的命名空间(路径)
define('CONTROLLER_PATH', self::getSpace($varAddon, $urlCase));
// 获取控制器和操作名
define('CONTROLLER_NAME', defined('BIND_CONTROLLER') ? BIND_CONTROLLER : self::getController($varController, $urlCase));
define('ACTION_NAME', defined('BIND_ACTION') ? BIND_ACTION : self::getAction($varAction, $urlCase));
// 当前控制器的UR地址
$controllerName = defined('CONTROLLER_ALIAS') ? CONTROLLER_ALIAS : CONTROLLER_NAME;
define('__CONTROLLER__', __MODULE__ . $depr . (defined('BIND_CONTROLLER') ? '' : ($urlCase ? parse_name($controllerName) : $controllerName)));
// 当前操作的URL地址
define('__ACTION__', __CONTROLLER__ . $depr . (defined('ACTION_ALIAS') ? ACTION_ALIAS : ACTION_NAME));
//保证$_REQUEST正常取值
$_REQUEST = array_merge($_POST, $_GET, $_COOKIE);
// -- 加了$_COOKIE. 保证哦..
}
示例10: send_http_status
case "404_1":
send_http_status(404);
echo '{"request_id":100, "error_code":10000 , "error_msg":"what is that??"}';
break;
case "404_2":
send_http_status(404);
echo 'what is this??';
break;
case "200_1":
send_http_status(200);
echo '{"request_id":100, "response_params":[1,2,3,4]}';
break;
case "200_2":
send_http_status(200);
echo 'what is this??';
case "200_3":
send_http_status(200);
echo '{"request_id":100, "error_code":4567}';
break;
case 'checkSign':
send_http_status(200);
$rs = array('request_id' => 100, 'response_params' => $_REQUEST);
echo json_encode($rs);
break;
default:
send_http_status(204);
}
} else {
$log->log(print_r($_REQUEST, true));
echo json_encode($_REQUEST);
}
示例11: exec
/**
+----------------------------------------------------------
* 执行应用程序
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public static function exec()
{
// 安全检测df
if (!preg_match('/^[A-Za-z_0-9]+$/', MODULE_NAME)) {
$module = false;
} else {
//创建Action控制器实例
$group = defined('GROUP_NAME') ? GROUP_NAME . '/' : '';
$module = A($group . MODULE_NAME);
}
if (!$module) {
if (function_exists('__hack_module')) {
// hack 方式定义扩展模块 返回Action对象
$module = __hack_module();
if (!is_object($module)) {
// 不再继续执行 直接返回
return;
}
} else {
// 是否定义Empty模块
$module = A('Empty');
if (!$module) {
$msg = L('_MODULE_NOT_EXIST_') . MODULE_NAME;
if (APP_DEBUG) {
// 模块不存在 抛出异常
throw_exception($msg);
} else {
if (C('LOG_EXCEPTION_RECORD')) {
Log::write($msg);
}
send_http_status(404);
exit;
}
}
}
}
//获取当前操作名
$action = ACTION_NAME;
// 获取操作方法名标签
tag('action_name', $action);
if (method_exists($module, '_before_' . $action)) {
// 执行前置操作
call_user_func(array(&$module, '_before_' . $action));
}
//执行当前操作
call_user_func(array(&$module, $action));
if (method_exists($module, '_after_' . $action)) {
// 执行后缀操作
call_user_func(array(&$module, '_after_' . $action));
}
return;
}
示例12: _404
/**
* YourPHP 函数类
*/
function _404()
{
send_http_status(404);
exit;
}
示例13: dispatch
//.........这里部分代码省略.........
break;
}
}
}
if (empty($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = '';
}
$depr = C('URL_PATHINFO_DEPR');
define('MODULE_PATHINFO_DEPR', $depr);
define('__INFO__', trim($_SERVER['PATH_INFO'], '/'));
// URL后缀
define('__EXT__', strtolower(pathinfo($_SERVER['PATH_INFO'], PATHINFO_EXTENSION)));
if (__INFO__ && C('MULTI_MODULE') && !isset($_GET[$varModule])) {
// 获取模块
$paths = explode($depr, __INFO__, 2);
$allowList = C('MODULE_ALLOW_LIST');
$module = preg_replace('/\\.' . __EXT__ . '$/i', '', $paths[0]);
if (empty($allowList) || is_array($allowList) && in_array_case($module, $allowList)) {
$_GET[$varModule] = $module;
$_SERVER['PATH_INFO'] = isset($paths[1]) ? $paths[1] : '';
} else {
$_SERVER['PATH_INFO'] = __INFO__;
}
} else {
$_SERVER['PATH_INFO'] = __INFO__;
}
// 获取模块名称
define('MODULE_NAME', self::getModule($varModule));
// 检测模块是否存在
if (MODULE_NAME && (!in_array_case(MODULE_NAME, C('MODULE_DENY_LIST')) || $domainModule) && is_dir(APP_PATH . MODULE_NAME)) {
// 定义当前模块路径
define('MODULE_PATH', APP_PATH . MODULE_NAME . '/');
// 加载模块配置文件
if (is_file(MODULE_PATH . 'Conf/config.php')) {
C(include MODULE_PATH . 'Conf/config.php');
}
/**加载模板公共配置文件
* 2015-5-14 13:43
* 增加模板配置文件加载 start
* @author 郑钟良<zzl@ourstu.com>
*/
if (is_file(OS_THEME_PATH . 'config.php')) {
$TMPL_PARSE_STRING = C('TMPL_PARSE_STRING');
C(include OS_THEME_PATH . 'config.php');
$NEW_TMPL_PARSE_STRING = C('TMPL_PARSE_STRING');
$NEW_TMPL_PARSE_STRING = array_merge($NEW_TMPL_PARSE_STRING, $TMPL_PARSE_STRING);
C('TMPL_PARSE_STRING', $NEW_TMPL_PARSE_STRING);
}
/**
* 2015-5-14 13:43
* 增加模板配置文件加载 end
* @author 郑钟良<zzl@ourstu.com>
*/
// 加载模块别名定义
if (is_file(MODULE_PATH . 'Conf/alias.php')) {
Think::addMap(include MODULE_PATH . 'Conf/alias.php');
}
// 加载模块函数文件
if (is_file(MODULE_PATH . 'Common/function.php')) {
include MODULE_PATH . 'Common/function.php';
}
} else {
E(L('_MODULE_NOT_EXIST_') . ':' . MODULE_NAME, 815);
}
if ('' != $_SERVER['PATH_INFO']) {
// 检查禁止访问的URL后缀
if (C('URL_DENY_SUFFIX') && preg_match('/\\.(' . trim(C('URL_DENY_SUFFIX'), '.') . ')$/i', $_SERVER['PATH_INFO'])) {
send_http_status(404);
exit;
}
if (C('URL_HTML_SUFFIX')) {
$_SERVER['PATH_INFO'] = preg_replace('/\\.(' . trim(C('URL_HTML_SUFFIX'), '.') . ')$/i', '', $_SERVER['PATH_INFO']);
} else {
$_SERVER['PATH_INFO'] = preg_replace('/\\.' . __EXT__ . '$/i', '', $_SERVER['PATH_INFO']);
}
$depr = C('URL_PATHINFO_DEPR');
$paths = explode($depr, trim($_SERVER['PATH_INFO'], $depr));
if (!isset($_GET[$varController])) {
// 获取控制器
$_GET[$varController] = array_shift($paths);
}
// 获取操作
$_GET[$varAction] = array_shift($paths);
// 解析剩余的URL参数
$var = array();
if (C('URL_PARAMS_BIND') && 1 == C('URL_PARAMS_BIND_TYPE')) {
// URL参数按顺序绑定变量
$var = $paths;
} else {
preg_replace_callback('/(\\w+)\\/([^\\/]+)/', function ($match) use(&$var) {
$var[$match[1]] = strip_tags($match[2]);
}, implode('/', $paths));
}
$_GET = array_merge($var, $_GET);
}
define('CONTROLLER_NAME', self::getController($varController));
define('ACTION_NAME', self::getAction($varAction));
//保证$_REQUEST正常取值
$_REQUEST = array_merge($_POST, $_GET);
}
示例14: not_found
/**
* 404
*/
public function not_found()
{
send_http_status(404);
$this->__view("home/404.php");
}
示例15: _empty
public function _empty()
{
send_http_status(404);
$this->display(TMPL_PATH . '404.html');
}