当前位置: 首页>>代码示例>>PHP>>正文


PHP Flight::notFound方法代码示例

本文整理汇总了PHP中Flight::notFound方法的典型用法代码示例。如果您正苦于以下问题:PHP Flight::notFound方法的具体用法?PHP Flight::notFound怎么用?PHP Flight::notFound使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Flight的用法示例。


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

示例1: selectByUser

 public static function selectByUser($id)
 {
     $connection = Flight::dbMain();
     try {
         $sql = "SELECT * FROM user_online WHERE user_id = :user_id;";
         $query = $connection->prepare($sql);
         $query->bindParam(':user_id', $id, PDO::PARAM_INT);
         $query->execute();
         if ($query->rowCount() < 1) {
             Flight::notFound("user_id not found");
         }
         $row = $query->fetch(PDO::FETCH_ASSOC);
         $userOnline = new UserOnline();
         $userOnline->Id = (int) $row['id'];
         $userOnline->User = User::select($row['user_id']);
         $userOnline->Dt = $row['online_dt'];
         return $result;
     } catch (PDOException $pdoException) {
         throw $pdoException;
     } catch (Exception $exception) {
         throw $exception;
     } finally {
         $connection = null;
     }
 }
开发者ID:rhalf,项目名称:app_track,代码行数:25,代码来源:useronline.php

示例2: bgp_safe_require

/**
 * Secure require_once alias for the routing component of the system
 */
function bgp_safe_require($path)
{
    if (file_exists($path)) {
        // Protect class files and xml files from being called directly
        if (strpos($path, '.class') === FALSE && strpos($path, '.xml') === FALSE && strpos($path, '.ini') === FALSE) {
            require_once $path;
            return 0;
        }
    }
    Flight::notFound();
}
开发者ID:master3395,项目名称:bgpanelv2,代码行数:14,代码来源:func.inc.php

示例3: getPlaylists

    $playlists = getPlaylists();
    Flight::render('playlists', array('playlists' => $playlists), 'body_content');
    Flight::render('layout', array('Titre' => 'Playlists'));
});
Flight::route('GET /playlist/create', function ($id) {
    Flight::render('createPlaylist');
});
// Lecture APP
Flight::route('GET /playlist/@id', function ($id) {
    $playlist = json_decode(getPlayList($id));
    $tracks = getProposedTracks($id);
    //------
    $include_in_header = '<script type="text/javascript" src="http://cdn-files.deezer.com/js/min/dz.js"></script>';
    $footer_content = '<script type="text/javascript" src="' . _URL_APP_THEME_ . 'js/WebPlayerController.js"></script>';
    if (isset($album->error)) {
        Flight::notFound();
    }
    //------
    Flight::render('playlist', array('playlist' => $playlist, 'tracks' => $tracks), 'body_content');
    Flight::render('layout', array('Titre' => $playlist[0]->titre, 'include_in_header' => $include_in_header, 'footer_content' => $footer_content));
});
/**
****
******
******
****** routing proposedTracks
******
******
****
**/
Flight::route('GET /proposedtrack/create', function () {
开发者ID:artz20,项目名称:playlists-par-deezer,代码行数:31,代码来源:index.php

示例4: function

            $id = Flight::get('hash')->decode($hash);
            if (!$id) {
                Flight::json(['status' => 0, 'msg' => '短址无法解析']);
            } else {
                $store = Flight::get('db')->select('urls', ['url'], ['id' => $id]);
                if (!$store) {
                    Flight::json(['status' => 0, 'msg' => '地址不存在']);
                } else {
                    Flight::json(['status' => 1, 'url' => $store[0]['url']]);
                }
            }
        }
    }
});
Flight::route('/@hash', function ($hash) {
    $id = Flight::get('hash')->decode($hash);
    if (!$id) {
        Flight::notFound('短址无法解析');
    } else {
        $store = Flight::get('db')->select('urls', ['url'], ['id' => $id]);
        if (!$store) {
            Flight::notFound('地址不存在');
        } else {
            Flight::get('db')->update('urls', ['count[+]' => 1], ['id' => $id]);
            Flight::redirect($store[0]['url'], 302);
        }
    }
});
Flight::map('notFound', function ($message) {
    Flight::response()->status(404)->header('content-type', 'text/html; charset=utf-8')->write('<h1>404 页面未找到</h1>' . "<h3>{$message}</h3>" . '<p><a href="' . Flight::get('flight.base_url') . '">回到首页</a></p>' . str_repeat(' ', 512))->send();
});
开发者ID:npk,项目名称:Ourls,代码行数:31,代码来源:routes.php

示例5: notFound

 public function notFound()
 {
     return Flight::notFound();
 }
开发者ID:newmediakassel,项目名称:website015,代码行数:4,代码来源:index.php

示例6: json_encode

    $mainData['bbox'] = json_encode([[min($arrBbox[1], $arrBbox[3]), min($arrBbox[0], $arrBbox[2])], [max($arrBbox[1], $arrBbox[3]), max($arrBbox[0], $arrBbox[2])]]);
    $proName = $mainData['prov_name'];
    $regName = $mainData['reg_name'];
    $munName = $mainData['name'];
    $query = "SELECT stat.* FROM it_comuni com JOIN it_stats stat ON com.osm_id = stat.osm_id WHERE com.cod_istat=" . $db->quote($mainData['cod_istat']) . " AND data > (CURRENT_DATE - 30) ORDER BY data ASC";
    $res = $db->query($query);
    $stats = $res->fetchAll();
    Flight::render('extract.php', array('baseUrl' => Flight::request()->base, 'pTitle' => $municipality . ', ' . $province . ', ' . $region, 'region' => $regName, 'region_safe' => $region, 'province' => $proName, 'province_safe' => $province, 'municipality' => $munName, 'municipality_safe' => $municipality, 'mainData' => $mainData, 'stats' => $stats));
});
Flight::route('/@region/@province/@municipality/stats', function ($region, $province, $municipality) {
    checkLang();
    $db = Flight::db();
    $query = "SELECT com.osm_id,com.cod_istat,com.name, com.safe_name, pro.name AS prov_name, reg.name AS reg_name FROM it_regioni reg JOIN it_province pro ON reg.cod_istat = pro.cod_istat_reg JOIN it_comuni com ON pro.cod_istat=com.cod_istat_pro WHERE com.safe_name=" . $db->quote($municipality) . " AND pro.safe_name=" . $db->quote($province);
    $res = $db->query($query);
    $mainData = $res->fetchAll();
    if (count($mainData) == 0) {
        return Flight::notFound();
    }
    $mainData = $mainData[0];
    $proName = $mainData['prov_name'];
    $regName = $mainData['reg_name'];
    $munName = $mainData['name'];
    $query = "SELECT stat.* FROM it_comuni com JOIN it_stats stat ON com.osm_id = stat.osm_id WHERE com.cod_istat=" . $db->quote($mainData['cod_istat']) . " ORDER BY data ASC";
    $res = $db->query($query);
    $stats = $res->fetchAll();
    Flight::render('extractStats.php', array('baseUrl' => Flight::request()->base, 'pTitle' => $municipality . ', ' . $province . ', ' . $region, 'region' => $regName, 'region_safe' => $region, 'province' => $proName, 'province_safe' => $province, 'municipality' => $munName, 'municipality_safe' => $municipality, 'mainData' => $mainData, 'stats' => $stats));
});
Flight::map('notFound', function () {
    echo "404";
});
Flight::start();
开发者ID:mvexel,项目名称:osm-local-extracts,代码行数:31,代码来源:index.php


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