本文整理汇总了PHP中http::send方法的典型用法代码示例。如果您正苦于以下问题:PHP http::send方法的具体用法?PHP http::send怎么用?PHP http::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::send方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eqphp_autoload
function eqphp_autoload($lib_name)
{
$server_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$group = explode(',', config('group|info'));
$rq_url = explode('/', trim($server_uri, '/'));
$dir_first = array('a' => 'action', 'm' => 'model');
$dir_second = array('a' => $rq_url[0] . '/action', 'm' => $rq_url[0] . '/model');
$dir_arr = in_array($rq_url[0], $group) ? $dir_second : $dir_first;
$dir_arr = array_merge($dir_arr, array('s' => 'server', 'p' => 'plugin'));
$prefix = substr($lib_name, 0, strpos($lib_name, '_'));
$dir_name = in_array($prefix, array_keys($dir_arr)) ? $dir_arr[$prefix] : 'class';
$execute_file = $dir_name . '/' . $lib_name . '.php';
if (strtolower($lib_name) == 'smarty') {
$execute_file = 'data/smarty/Smarty.class.php';
}
if (file_exists($execute_file)) {
return include dc_root . $execute_file;
}
if ($prefix == 'a') {
$tpl_file = dc_root . 'view/' . substr($lib_name, 2) . '.html';
if (file_exists($tpl_file)) {
exit(include $tpl_file);
}
if ($execute_file != 'action/a_.php') {
http::send(404, 0);
http::out('404 Not Found');
}
}
if (strpos(strtolower($execute_file), 'smarty_internal_') === false) {
echo "class [" . $lib_name . "] is error !<br>";
}
}
示例2: eqphp_autoload
function eqphp_autoload($class)
{
if (isset($_SERVER['REQUEST_URI'])) {
$root = current(explode('/', trim($_SERVER['REQUEST_URI'], '/')));
}
//optimize: $config save memcache or redis
$group = config('group.list');
$path = isset($root) && is_array($group) && in_array($root, $group) ? $root . '/' : '';
$module = array('a' => $path . 'action', 'm' => $path . 'model', 'p' => $path . 'plugin', 's' => 'server');
$prefix = substr($class, 0, strpos($class, '_'));
$dir_name = in_array($prefix, array('a', 'm', 's', 'p')) ? $module[$prefix] : 'class';
$execute_file = $dir_name . '/' . $class . '.php';
if (file_exists($execute_file)) {
return include PATH_ROOT . $execute_file;
}
//通用加载
if (config('state.common_load') && in_array($prefix, array('a', 'm'), true)) {
$common_option = array('a' => 'action/', 'm' => 'model/');
$execute_file = PATH_ROOT . $common_option[$prefix] . $class . '.php';
if (file_exists($execute_file)) {
return include $execute_file;
}
}
//贪婪加载
if (config('state.greedy_load')) {
$execute_file = file::search(PATH_ROOT . $dir_name, $class, $file_list, true);
if ($execute_file) {
return include $execute_file;
}
}
if ($prefix === 'a') {
logger::notice('class [' . $class . '] not found');
http::send(404);
}
}
示例3: bootstrap
static function bootstrap($controller, $method)
{
try {
if ($controller && $method) {
define('CURRENT_ACTION', substr($controller . ':' . $method, 2));
if (property_exists($controller, 'static_class')) {
if (method_exists($controller, '__before')) {
call_user_func($controller . '::__before');
}
call_user_func(array($controller, $method), explode('/', URL_REQUEST));
if (method_exists($controller, '__after')) {
call_user_func($controller, '::__after');
}
} else {
$object = new $controller();
if (method_exists($controller, '__before')) {
$object->__before();
}
call_user_func_array(array($object, $method), array(explode('/', URL_REQUEST)));
if (method_exists($controller, '__after')) {
$object->__after();
}
}
} else {
throw new Exception('absent controller or method', 101);
}
} catch (Exception $e) {
logger::exception('exception', $e->getCode() . ' : ' . $e->getMessage());
if (preg_match('/^(similar|product)$/', ENVIRONMENT)) {
if (http::is_ajax()) {
http::json(array('error' => 4, 'message' => $e->getMessage(), 'data' => null));
} else {
http::send(404);
}
}
debug::exception($e);
}
}
示例4: tidy
static function tidy()
{
http::send(500);
}