本文整理汇总了PHP中error_404函数的典型用法代码示例。如果您正苦于以下问题:PHP error_404函数的具体用法?PHP error_404怎么用?PHP error_404使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_404函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loader
/**
* Wing loader
*/
function loader()
{
$_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']);
if (preg_match('/.php/', $_SERVER['REQUEST_URI'])) {
$GLOBALS['request'] = mb_substr($_SERVER['REQUEST_URI'], stripos($_SERVER['REQUEST_URI'], '.php') + 4);
} else {
$GLOBALS['request'] = $_SERVER['REQUEST_URI'];
}
$GLOBALS['request'] = explode('/', $GLOBALS['request']);
if (@(!$GLOBALS['request'][1])) {
$GLOBALS['request'][1] = 'home';
}
if (@(!$GLOBALS['request'][2])) {
$GLOBALS['request'][2] = '_';
}
if (@(!$GLOBALS['request'][3])) {
$GLOBALS['request'][3] = '0';
}
file_exists(APP_CONTROL . "/{$GLOBALS['request'][1]}.php") or error_404("Control {$GLOBALS['request'][1]} not exists.");
require APP_CONTROL . "/{$GLOBALS['request'][1]}.php";
$GLOBALS['request'][1] = ucfirst($GLOBALS['request'][1]);
$control = new $GLOBALS['request'][1]();
if (method_exists($control, $GLOBALS['request'][2])) {
$control->{$GLOBALS}['request'][2]($GLOBALS['request'][3]);
} else {
method_exists($control, '__') or die("Method {$GLOBALS['request'][2]} not exists.");
$control->__($GLOBALS['request'][2]);
}
}
开发者ID:iabing,项目名称:wing,代码行数:32,代码来源:wings.php
示例2: api_keys_utils_get_from_url
function api_keys_utils_get_from_url($more = array())
{
$defaults = array('allow_disabled' => 0, 'ensure_isown' => 1);
$more = array_merge($defaults, $more);
$api_key = request_str("api_key");
# OAuth2 section 2.2 ...
if (!$api_key) {
$api_key = request_str("client_id");
}
if (!$api_key) {
error_404();
}
$key_row = api_keys_get_by_key($api_key);
if (!$key_row) {
error_404();
}
if ($key_row['deleted']) {
error_410();
}
if ($more['ensure_isown']) {
if ($key_row['user_id'] != $GLOBALS['cfg']['user']['id']) {
error_403();
}
}
if (!$more['allow_disabled']) {
if ($key_row['disabled']) {
error_403();
}
}
return $key_row;
}
开发者ID:alokc83,项目名称:flamework-api,代码行数:31,代码来源:lib_api_keys_utils.php
示例3: route
static function route()
{
$url = explode('?', $_SERVER['REQUEST_URI']);
$path = mb_strtolower($url[0]);
while (substr($path, -1) == '/') {
$path = mb_substr($path, 0, mb_strlen($path) - 1);
}
$path_components = explode('/', $path);
//default actions are called 'index'
$action = "index";
//Handle home page requests
if (count($path_components) == 1) {
router::perform_controller_action("home", $action, array(), array());
}
//Loop through all the routes we defined in route.php, and try to find one that matches our request
foreach ($GLOBALS['routes'] as $route => $controller) {
$route_components = explode("/", $route);
$action = "index";
$i = 0;
$objects = array();
$goodRoute = true;
$path_components = array_pad($path_components, count($route_components), '');
$parameters = array();
//Handle routes that call a specific action
$controller_action_array = explode(":", $controller);
$controller = $controller_action_array[0];
if (count($controller_action_array) == 2) {
$action = $controller_action_array[1];
}
//Loop through each component of this route until we find a part that doesn't match, or we run out of url
foreach ($route_components as $route_component) {
//This part of the route is a named parameter
if (substr($route_component, 0, 1) == ":") {
$parameters[substr($route_component, 1)] = $path_components[$i];
//This part of the route is an action for a controller
} elseif ($route_component == "[action]") {
if ($path_components[$i] != "") {
$action = str_replace("-", "_", $path_components[$i]);
}
//This part of the route will require that we create an object
} elseif (substr($route_component, 0, 1) == "(" && substr($route_component, -1, 1) == ")") {
$reflection_obj = new ReflectionClass(substr($route_component, 1, strlen($route_component) - 2));
$object = $reflection_obj->newInstanceArgs(array($path_components[$i]));
$objects[] = $object;
//Part of the url that isn't an action or an object didn't match, this definitely isn't the right route
} elseif ($route_component != $path_components[$i] && str_replace("-", "_", $route_component) != $path_components[$i]) {
//echo "Bad match: ".str_replace("-","_",$route_component)." != ".$path_components[$i]."<br />";
$goodRoute = false;
break;
}
$i++;
}
//This route is a match for our request, let's get the controller working on it
if ($goodRoute && ($i >= count($path_components) || $path_components[$i] == "")) {
router::perform_controller_action($controller, $action, $objects, $parameters);
}
}
error_404();
}
开发者ID:javier-nogales,项目名称:php-mvc-router,代码行数:59,代码来源:router.php
示例4: json
function json($data)
{
if (!count($data) > 0) {
error_404();
} else {
header('Content-type: text/html');
echo json_encode($data);
}
}
开发者ID:robertorubioes,项目名称:InertiaFramework,代码行数:9,代码来源:Controller.php
示例5: get_page
/**
* Display a page if the file exists, otherwise displays a 404.
*
* @param string $sPage The page.
* @return void
*/
function get_page($sPage)
{
if (is_file($sPage)) {
$sPage = file_get_contents($sPage);
echo parse_var($sPage);
} else {
// Set the Not Found page
error_404();
}
}
开发者ID:joswilson,项目名称:NotJustOK,代码行数:16,代码来源:fns.php
示例6: index
public function index($id, $name)
{
$vars =& $this->data;
$cultivo = Doctrine::getTable('Cultivo')->find($id);
if (!$cultivo) {
error_404('No tenemos informacion acerca de ese cultivo');
} else {
$vars['cultivo'] =& $cultivo;
}
$this->load->view('components/ficha', $vars);
}
开发者ID:nemesys101,项目名称:huertas,代码行数:11,代码来源:cultivos.php
示例7: mapping_controller
/**
* Encuentra el controlador que mapea
* @param type $controladores
* @return type
*/
function mapping_controller($controladores, $uriapp = NULL)
{
$mapea = FALSE;
//Recorre todos los controladores hasta que uno coincida con la URI actual
foreach ($controladores as $controlador_esp) {
//Analiza si el controlador mapea con la uri actual
$mapea = maps_actual_url($controlador_esp['url'], $uriapp);
if ($mapea) {
return $controlador_esp;
}
}
//si ningun controlador mapeo avisa el problema
if (!$mapea) {
error_404();
}
}
开发者ID:CGGStudio,项目名称:enolaphp,代码行数:21,代码来源:http.php
示例8: runController
/**
* 进行路由方法请求
*
* @param string $op 执行方法
* @param string $namespaces 命名空间
*/
public static function runController($controllerName, $op, $namespaces)
{
$class = $namespaces . $controllerName;
//实例化controller
$controller = new $class();
//验证方法是否存在
if (method_exists($controller, $op) == FALSE) {
error_404();
}
//验证通过,执行方法
$controller->{$op}();
//记录路由日志
$msg = 'method:' . filter_input(INPUT_SERVER, 'REQUEST_METHOD') . ',url:' . filter_input(INPUT_SERVER, 'REQUEST_URI') . ',Http Status:' . filter_input(INPUT_SERVER, 'REDIRECT_STATUS');
Log::info($msg);
exit;
}
开发者ID:y80x86ol,项目名称:simpla-framework,代码行数:22,代码来源:Route.php
示例9: features_ensure_enabled
<?php
include "include/init.php";
features_ensure_enabled(array("api", "api_documentation"));
$default = $GLOBALS['cfg']['api']['default_format'];
$formats = $GLOBALS['cfg']['api']['formats'];
$format = get_str("format");
if (!$format) {
error_404();
}
if (!in_array($format, $formats)) {
error_404();
}
$GLOBALS['smarty']->assign("default", $default);
$GLOBALS['smarty']->assign("format", $format);
$GLOBALS['smarty']->display("page_api_format.txt");
exit;
开发者ID:whosonfirst,项目名称:flamework-api,代码行数:17,代码来源:api_format.php
示例10: db
require CORE_PATH . '/db.php';
$db = new db();
if (isset($config['DB_DRIVER'])) {
$db->set_driver($config['DB_DRIVER']);
}
if (isset($config['DB_PREFIX'])) {
$db->prefix($config['DB_PREFIX']);
}
$db_host = $config['DB_HOST'] . (isset($config['DB_PORT']) ? ':' . $config['DB_PORT'] : '');
$db->setting($db_host, $config['DB_USER'], $config['DB_PSWD'], $config['DB_NAME']);
$script = APP_PATH . 'action/' . MODULE . 'Action.php';
if (!file_exists($script)) {
error_404('Can not find the action ' . MODULE . 'Action.php');
} else {
require $script;
$class = MODULE . 'Action';
$method = ACTION;
if ($method != $class) {
$run = new $class();
if (is_callable(array($run, $method))) {
$run->{$method}();
} else {
error_404("Call to undefined method({$method}) in the class({$class})");
}
} else {
error("The action name({$method}) must be not the same as the module name({$class})");
}
}
if ($db->conn) {
$db->close();
}
开发者ID:Jeremysoft,项目名称:mallmold,代码行数:31,代码来源:run.php
示例11: error_404
function error_404($message)
{
include ROOT . '/public/tpl/error_404.html.php';
exit;
}
//+---------------------------------------------------------------
//| 实例化默认需要加载的类
//+---------------------------------------------------------------
__autoload('mysql');
__autoload('common');
$db = new common();
//+---------------------------------------------------------------
//| 模块加载
//+---------------------------------------------------------------
$a = $db->get('a') == '' ? 'index' : $db->get('a');
$a_file = ROOT . '/' . APP . '/' . $a . '.php';
if (!file_exists($a_file)) {
error_404('The requested page was not found on this server!');
// 模块操作文件找不到
} else {
// 开启缓冲
ob_start();
// 加载模块操作文件
require_once $a_file;
$content = '';
$content = ob_get_contents();
// 清空(擦除)缓冲区并关闭输出缓冲
ob_end_clean();
// 输出内容
echo $content;
}
开发者ID:kenleemyth,项目名称:MythPHPQuery,代码行数:31,代码来源:myth.php
示例12: getRouteArray
/**
* 获取路由数组
* @return type
*/
private static function getRouteArray()
{
//获取请求URL
$requestUrl = ltrim(rtrim($_SERVER['REQUEST_URI'], '/'), '/');
//处理特殊情况,去掉index.php/
if (substr($requestUrl, 0, 9) == 'index.php') {
$requestUrl = substr($requestUrl, 10);
}
//去除?以后的所有参数
$requestUrl = String::urlSafetyFilter($requestUrl);
$requestUrlArr = explode('?', $requestUrl);
//处理请求URL
$requestUrlArr = explode('/', $requestUrlArr[0]);
if (count($requestUrlArr) == 0) {
error_404();
}
$requestUrlArr = self::secondDomainFilter($requestUrlArr);
return $requestUrlArr;
}
开发者ID:y80x86ol,项目名称:simpla-framework,代码行数:23,代码来源:RouteHandle.php
示例13: _init_mod
private function _init_mod($options = array())
{
$mod_default = $options['mod_default'] ? $options['mod_default'] : 'index';
$mod = $this->_g('mod');
if (empty($mod)) {
$mod = $mod_default;
}
if (!isset($this->var['config']['modules'][$mod]) && false == @file_exists($options['modules_path'] . $mod . '.mod.php')) {
if ($options['mod_exit']) {
error_404('mod ' . $mod . ' is not exists');
} else {
if ($mod) {
$this->var['mod_original'] = $_POST['mod_original'] = $_GET['mod_original'] = $mod;
$mod = 'topic';
} else {
$mod = $mod_default;
}
}
}
define('CURMODULE', $mod);
$this->var['mod'] = $_POST['mod'] = $_GET['mod'] = $mod;
$this->var['code'] = $_POST['code'] = $_GET['code'] = $this->_g('code');
return $mod;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:24,代码来源:jishigou.php
示例14: flickr_users_get_by_url
function flickr_users_get_by_url($error_404 = 1)
{
$path = get_str("path");
$nsid = get_str("nsid");
if ($path && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
loadlib("flickr_users_path_aliases");
$alias = flickr_users_path_aliases_get_by_alias($path);
if ($alias && $alias['redirect_to']) {
$new_path = urlencode($alias['redirect_to']);
$redir = str_replace($path, $new_path, $_SERVER['REQUEST_URI']);
header("location: {$redir}");
}
}
if ($path) {
$flickr_user = flickr_users_get_by_path_alias($path);
# see also: notes in flickr_users_create_user()
# see also: inc_path_alias_conflict.txt
if ($flickr_user && $GLOBALS['cfg']['enable_feature_path_alias_redirects']) {
$other_flickr_user = _flickr_users_get_by_path_alias($path);
$other_user = users_get_by_id($other_flickr_user['user_id']);
$GLOBALS['smarty']->assign("path_alias_conflict", 1);
$GLOBALS['smarty']->assign_by_ref("path_alias_other_user", $other_user);
$GLOBALS['smarty']->assign_by_ref("path_alias_other_flickr_user", $other_flickr_user);
}
} else {
if ($nsid) {
$flickr_user = flickr_users_get_by_nsid($nsid);
}
}
if (!$flickr_user && $error_404) {
error_404();
}
return $flickr_user;
}
开发者ID:nilswalk,项目名称:parallel-flickr,代码行数:34,代码来源:lib_flickr_users.php
示例15: users_ensure_valid_user_from_url
function users_ensure_valid_user_from_url($method = '')
{
if (strtolower($method) == 'post') {
$user_id = post_int64('user_id');
} else {
$user_id = get_int64('user_id');
}
if (!$user_id) {
error_404();
}
$user = users_get_by_id($user_id);
if (!$user || $user['deleted']) {
error_404();
}
return $user;
}
开发者ID:nilswalk,项目名称:parallel-flickr,代码行数:16,代码来源:lib_users.php
示例16: explode
<?php
$uri = $_SERVER['REQUEST_URI'];
$uri = explode('?', $uri)[0];
/*echo $uri;*/
$personal_uri = '/' . explode('/', $uri)[1] . '/' . explode('/', $uri)[2] . '/';
echo $personal_uri;
if ($uri == $personal_uri or $uri == $personal_uri . 'index.php') {
$response = list_action();
} elseif ($uri == $personal_uri . 'index.php/admin') {
$response = admin_action();
} elseif ($uri == $personal_uri . 'index.php/show') {
$response = show_action($_REQUEST['id']);
} elseif ($uri == $personal_uri . 'index.php/remove') {
$response = remove_action($_REQUEST['id']);
} elseif ($uri == $personal_uri . 'index.php/edit') {
$response = edit_action($_REQUEST['id']);
} elseif ($uri == $personal_uri . 'index.php/add') {
$response = add_action($_REQUEST['id']);
} elseif ($uri == $personal_uri . 'index.php/about') {
$response = about_action();
} else {
$response = error_404();
}
开发者ID:KollaneSnake,项目名称:TryToConnectGithub,代码行数:24,代码来源:Routing.php
示例17: error_404
if ($controllerNotExists) {
error_404("Controller does not exists {$controller_path}");
} else {
if ($controller === DEFAULT_CONTROLLER) {
$controller_path = BASE_PATH . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php';
}
if (!file_exists($controller_path) && !is_dir($controller_path)) {
error_404("Controller does not exists {$controller_path}");
} else {
if (is_dir($path)) {
$dir = explode(DIRECTORY_SEPARATOR, $path);
$dir = end($dir);
if (isset($default_controllers[$dir])) {
$controller = $default_controllers[$dir];
$controller_path = $path . DIRECTORY_SEPARATOR . $controller . '.php';
}
}
}
require_once $controller_path;
eval("\$controller_instance = new " . ucfirst($controller) . "();");
if (!method_exists($controller_instance, $function)) {
error_404("Function does not exists {$controller_path} method: {$function}");
} else {
call_user_func_array(array($controller_instance, $function), $params);
}
}
function error_404($msg)
{
echo $msg;
die;
}
开发者ID:sisjosex,项目名称:phpadmin,代码行数:31,代码来源:router.php
示例18: load_page
function load_page($page_name, array $params = array())
{
$page_cfg = get_page_config($page_name);
$page_path = get_page_path($page_name);
if (!file_exists($page_path)) {
return error_404($page_name, $params);
}
list($content, $template) = treat_file_by_extension($page_path, $params);
if ($template) {
settings('content', settings('pre_content', null, '') . $content);
settings('subtitle', $page_name);
$content = load_template($params);
}
return $content;
}
开发者ID:atelierspierrot,项目名称:demo-builder,代码行数:15,代码来源:demo-builder-lib.php
示例19: download
public function download($params = [])
{
//echo '<pre>'; print_r($params); echo '</pre>'; exit;
$setups_map = ['NET' => ['setup-4.0.msi' => 'WinWrap-NET4.0-setup.msi'], 'WPF' => ['setup-4.0-wpf.msi' => 'WinWrap-WPF4.0-setup.msi'], 'AZW' => ['setup-4.0-azw.msi' => 'WinWrap-AZW4.0-setup.msi'], 'COM' => ['setup32.msi' => 'WinWrap-COM32-setup.msi', 'setup64.msi' => 'WinWrap-COM64-setup.msi']];
$all = [];
foreach ($setups_map as $setup_map) {
$all += $setup_map;
}
//$setups_map['ALL'] = $all; // disable for now (1/8/15)
// select the platform's setup_map
$platform = $params['platform'];
$setup_map = $setups_map[$platform];
if (!isset($setup_map)) {
error_404();
}
// select the evaluator
$key = $params['key'];
$evaluator = Evaluator::read_by_key($key);
//Render::json($evaluator); exit; // debug
$error = false;
if (!isset($evaluator['id'])) {
$error = 'Invalid evaluator key.';
} else {
if (Util2::expired($evaluator['agreement_date'], 60, $evaluator['expiration_date'])) {
$error = 'Evaluation period has expired.';
}
}
if ($error) {
Render::html(Doc::by_name('message')['content'], ['title' => 'Download Request Failed', 'message' => $error]);
return;
}
// create evaluator cerificate
$readme = Template::render_doc_by_name('evaluate-readme');
$certificate = new Certificate();
$certificate->set_by_evaluator($evaluator, true);
// add download record
$version = file_get_contents(EVALDIR . 'version.txt');
$model = ['evaluator_id' => $evaluator['id'], 'ip' => $_SERVER['REMOTE_ADDR'], 'platform' => $platform != 'ALL' ? $platform : implode(',', array_keys($setups_map)), 'version' => $version];
$download = EvaluatorDownload::create($model);
// create signed certificate
$html = $certificate->sign();
//Render::text($_SERVER['HTTP_HOST'] . SUBDIR . "\r\n" . $html); exit;
// create a temporary file
$path = tempnam("tmp", "zip");
$zipname = 'WinWrap-Basic-Evaluation-' . $platform;
$zip = new ZipArchive();
$okay = $zip->open($path, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$okay |= $zip->addEmptyDir($zipname);
$okay |= $zip->addFromString($zipname . '/readme.htm', $readme);
$okay |= $zip->addFromString($zipname . '/Evaluation.htm', $html);
$okay |= $zip->addFromString($zipname . '/version.txt', $version);
foreach ($setup_map as $setup => $name) {
$okay |= $zip->addFile(EVALDIR . $setup, $zipname . '/' . $name);
}
$okay |= $zip->close();
if (!$okay) {
Render::text("ZipArchive failed.");
return;
}
//$contents = file_get_contents($path);
//file_put_contents(TEMPDIR . 'x.zip', $contents);
// send zip file
if (true) {
header('Cache-Control: max-age=288000');
header('Content-Description: File Transfer');
header('Content-Type: application/zip');
//header("Content-Type: application/force-download");
header('Content-Length: ' . filesize($path));
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="' . $zipname . '.zip"');
ob_end_flush();
readfile($path);
}
unlink($path);
// set download date
$update = ['download_date' => gmdate('Y-m-d')];
EvaluatorDownload::update($update, $download['id']);
// done
exit;
}
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:80,代码来源:evaluate_ctrl.php
示例20: intval
<?
include('include/init.php');
#
# fetch avatar
#
$id_enc = intval($_GET['id']);
$avatar = db_single(db_fetch("SELECT * FROM glitchmash_avatars WHERE id='$id_enc'"));
if (!$avatar['id']) error_404();
$avatar['details'] = unserialize($avatar['details']);
foreach ($avatar['details'] as $slot => $id){
$clothing[$id]++;
}
#
# fetch player
#
$tsid_enc = AddSlashes($avatar['player_tsid']);
$avatar['player'] = db_single(db_fetch("SELECT * FROM glitchmash_players WHERE tsid='$tsid_enc'"));
#
# fetch all clothing rows
#
开发者ID:power7714,项目名称:glitch-mash,代码行数:31,代码来源:avatar.php
注:本文中的error_404函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论