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


PHP ClassLoader::addRepository方法代码示例

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


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

示例1: define

define('CONFIG_DIR', APP_DIR . 'config/');
// directory where libraries are located
define('LIBRARIES_DIR', APP_DIR . 'libraries/');
// directory for logs
define('LOGS_DIR', APP_DIR . 'logs/');
// output errors to brower
ini_set('display_errors', true);
// level of errors to log/display
ini_set('error_reporting', E_ALL);
// log errors
ini_set('log_errors', true);
// file for error logging
ini_set('error_log', LOGS_DIR . 'error_log');
require_once LIBRARIES_DIR . 'dabl/ClassLoader.php';
require_once LIBRARIES_DIR . 'dabl/print_r2.php';
// Strip added slashes if needed
if (get_magic_quotes_gpc()) {
    require_once LIBRARIES_DIR . 'dabl/strip_request_slashes.php';
    strip_request_slashes();
}
ClassLoader::addRepository('LIBRARIES', LIBRARIES_DIR);
ClassLoader::import('LIBRARIES:dabl');
if (is_file(APP_DIR . 'vendor/autoload.php')) {
    require_once APP_DIR . 'vendor/autoload.php';
}
// load all config files
$config_files = glob(CONFIG_DIR . '*.php');
sort($config_files);
foreach ($config_files as $filename) {
    require_once $filename;
}
开发者ID:abcarroll,项目名称:DABL,代码行数:31,代码来源:config.php

示例2: parse_ini_file

<?php

ClassLoader::addRepository('DATABASE', LIBRARIES_DIR . 'dabl/database');
ClassLoader::import('DATABASE');
ClassLoader::import('DATABASE:query');
ClassLoader::import('DATABASE:adapter');
if (!class_exists('PDO')) {
    ClassLoader::import('DATABASE:PDO');
}
$db_connections = parse_ini_file(CONFIG_DIR . 'connections.ini', true);
// connect to database(s)
foreach ($db_connections as $connection_name => $db_params) {
    DBManager::addConnection($connection_name, $db_params);
}
// timestamp to use for Created and Updated column values
define('CURRENT_TIMESTAMP', time());
define('MODELS_DIR', APP_DIR . 'models/');
define('MODELS_BASE_DIR', MODELS_DIR . 'base/');
define('MODELS_QUERY_DIR', MODELS_DIR . 'query/');
define('MODELS_BASE_QUERY_DIR', MODELS_DIR . 'query/base/');
ClassLoader::addRepository('MODELS', MODELS_DIR);
ClassLoader::import('MODELS');
ClassLoader::import('MODELS:base');
ClassLoader::addRepository('MODEL_QUERIES', MODELS_QUERY_DIR);
ClassLoader::import('MODEL_QUERIES');
ClassLoader::import('MODEL_QUERIES:base');
开发者ID:abcarroll,项目名称:DABL,代码行数:26,代码来源:database.php

示例3: session_get_cookie_params

    $params = session_get_cookie_params();
    setcookie(session_name(), '', time() - 42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
    if (!headers_sent()) {
        redirect('/');
    }
    throw new RuntimeException('Session ID was invalid and couldn\'t recover');
}
$result = @session_start();
if (!$result) {
    if (!headers_sent()) {
        redirect('/');
    }
    throw new RuntimeException('Session ID was invalid and couldn\'t recover');
}
// the browser path to this application.  it should be:
// a full url with http:// and a trailing slash OR
// a subdirectory with leading and trailing slashes
define('BASE_URL', '/');
// directory for public html files that are directly exposed to the web server
define('PUBLIC_DIR', APP_DIR . 'public/');
// default controller
define('DEFAULT_CONTROLLER', 'index');
// controllers directory
define('CONTROLLERS_DIR', APP_DIR . 'controllers/');
ClassLoader::addRepository('CONTROLLERS', CONTROLLERS_DIR);
// views directory
define('VIEWS_DIR', APP_DIR . 'views/');
// default timestamp format for views
define('VIEW_TIMESTAMP_FORMAT', 'n/j/Y g:i a');
// default date format for views
define('VIEW_DATE_FORMAT', 'n/j/Y');
开发者ID:abcarroll,项目名称:DABL,代码行数:31,代码来源:mvc.php


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