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


PHP F3::error方法代码示例

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


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

示例1: _get_f_list_id

function _get_f_list_id($uid)
{
    $facebook = F3::get('Facebook');
    $f_list_exists = false;
    try {
        // Try and see if they already have a "Single Yet?" friendslist
        // But maybe deleted their account from our site or somehow
        // their friendlist field went blank in the DB
        // And catch general Facebook errors...
        $f_lists = $facebook->api($uid . '/friendlists');
    } catch (FacebookApiException $e) {
        F3::error('500');
    }
    // Loop through each friendlist and
    // see if it is the Single Yet? friendlist
    foreach ($f_lists['data'] as $f_list) {
        if ($f_list['name'] == 'Single Yet?') {
            $f_list_exists = true;
            $f_list_id = $f_list['id'];
            // If there is a friendlist for Single Yet?, break out of loop.
            break;
        }
    }
    // If the Single Yet? friendlist doesn't exist, create it.
    if (!$f_list_exists) {
        $f_list = $facebook->api($uid . '/friendlists', 'post', array('name' => 'Single Yet?'));
        $f_list_id = $f_list['id'];
    }
    return $f_list_id;
}
开发者ID:nicholasserra,项目名称:singleyet,代码行数:30,代码来源:index.php

示例2: check_configuration

 public function check_configuration()
 {
     $config = new DB\Jig\Mapper($this->db, 'sysconfig.json');
     if (!$config->load()) {
         echo json_encode(array('message' => 'No config file found'));
         F3::error(428);
         exit;
     }
 }
开发者ID:boliviasoftware,项目名称:micro-system-maker,代码行数:9,代码来源:login.php

示例3: show_error

 public function show_error($message, $type)
 {
     echo json_encode($message);
     F3::error($type, $message);
 }
开发者ID:boliviasoftware,项目名称:micro-system-maker,代码行数:5,代码来源:common.php

示例4: start

 /**
 		Kickstart the framework
 			@public
 	**/
 public static function start()
 {
     // Get PHP settings
     $_ini = ini_get_all(NULL, FALSE);
     $_level = E_ALL ^ E_NOTICE;
     ini_set('error_reporting', $_level);
     // Intercept errors and send output to browser
     set_error_handler(function ($_errno, $_errstr) {
         // Bypass if error suppression (@) is enabled
         if (error_reporting()) {
             F3::error($_errstr, 500, debug_backtrace(FALSE));
         }
     }, $_level);
     // Do the same for PHP exceptions
     set_exception_handler(function ($_xcpt) {
         if (!count($_xcpt->getTrace())) {
             // Translate exception trace
             $_trace = debug_backtrace(FALSE);
             $_arg = $_trace[0]['args'][0];
             $_trace = array(array('file' => $_arg->getFile(), 'line' => $_arg->getLine(), 'function' => '{main}', 'args' => array()));
         } else {
             $_trace = $_xcpt->getTrace();
         }
         F3::error($_xcpt->getMessage(), $_xcpt->getCode(), $_trace);
         return;
         // PHP aborts at this point
     });
     if (isset(self::$global)) {
         // Multiple framework instances not allowed
         trigger_error(self::TEXT_Instance);
         return;
     }
     // Hydrate framework variables
     $_base = self::fixSlashes(realpath('.')) . '/';
     self::$global = array('AUTOLOAD' => $_base . 'autoload/', 'BASE' => $_base, 'DEBUG' => FALSE, 'ENCODING' => 'UTF-8', 'FONTS' => $_base, 'GUI' => $_base, 'IMPORTS' => $_base, 'LOADED' => array(), 'LOGS' => $_base . 'logs/', 'MAXSIZE' => self::bytes($_ini['post_max_size']), 'QUIET' => FALSE, 'RELEASE' => FALSE, 'SYNC' => self::SYNC_Default, 'TIME' => time(), 'THROTTLE' => 0, 'VERSION' => self::TEXT_Version);
     if (!in_array('zlib', get_loaded_extensions())) {
         // ZLib required
         self::$global['CONTEXT'] = 'zlib';
         trigger_error(self::TEXT_PHPExt);
         return;
     }
     // Create convenience containers for PHP globals
     foreach (explode('|', self::PHP_Globals) as $_var) {
         // Sync framework and PHP globals
         self::$global[$_var] =& $GLOBALS['_' . $_var];
         if ($_ini['magic_quotes_gpc'] && preg_match('/^[GPCR]/', $_var)) {
             // Corrective action on PHP magic quotes
             array_walk_recursive(self::$global[$_var], function (&$_val) {
                 $_val = stripslashes($_val);
             });
         }
     }
     // Use plain old output buffering as default
     $_handler = NULL;
     if (PHP_SAPI == 'cli') {
         // Command line: Parse GET variables in URL, if any
         preg_match_all('/[\\?&]([^=]+)=([^&$]*)/', $_SERVER['REQUEST_URI'], $_matches, PREG_SET_ORDER);
         foreach ($_matches as $_match) {
             $_REQUEST[$_match[1]] = $_match[2];
             $_GET[$_match[1]] = $_match[2];
         }
         // Custom server name
         $_SERVER['SERVER_NAME'] = strtolower($_SERVER['COMPUTERNAME']);
         // Convert URI to human-readable string
         self::mock('GET ' . $_SERVER['argv'][1]);
     } elseif (isset($_SERVER['HTTP_ACCEPT_ENCODING']) && preg_match('/gzip|deflate/', $_SERVER['HTTP_ACCEPT_ENCODING']) && !$_ini['zlib.output_compression'] && function_exists('apache_get_modules') && in_array('mod_deflate', apache_get_modules())) {
         // Use a conservative compression level
         ini_set('zlib.output_compression_level', self::GZIP_Compress);
         $_handler = 'ob_gzhandler';
     }
     ob_start($_handler);
     // Initialize profiler
     self::$global['PROFILE']['MEMORY']['start'] = memory_get_usage();
     // Initialize autoload stack
     spl_autoload_register('self::autoLoad');
 }
开发者ID:seyyah,项目名称:f3kayOLD,代码行数:80,代码来源:F3.php

示例5: needsLoggedIn

 /**
  * send 403 if not logged in
  *
  * @return void
  */
 public function needsLoggedIn()
 {
     if (\F3::get('auth')->isLoggedin() !== true) {
         \F3::error(403);
     }
 }
开发者ID:sevengage,项目名称:feed-merge,代码行数:11,代码来源:BaseController.php


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