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


PHP ClassLoader::mountPath方法代码示例

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


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

示例1: error_reporting

error_reporting(E_ALL);
if (!defined('TEST_INITIALIZED')) {
    // load classes and mount paths
    $cd = getcwd();
    $_SERVER["SCRIPT_FILENAME"] = dirname(__FILE__);
    chdir(dirname(dirname(__FILE__)));
    chdir('..');
    include_once 'application/Initialize.php';
    $arPath = realpath(getcwd() . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'activerecord' . DIRECTORY_SEPARATOR . 'ActiveRecord.php');
    include_once $arPath;
    ActiveRecord::setDSN('mysql://root@server/livecart');
    // set unittest and simpletest library root directory
    $libDir = dirname(dirname(__FILE__)) . '/_library/';
    ClassLoader::mountPath('phpunit', realpath($libDir . 'phpunit/'));
    ClassLoader::mountPath('unittest', realpath($libDir . 'unittest') . '/');
    ClassLoader::mountPath('testdir', dirname(__FILE__) . '/');
    ClassLoader::import("phpunit.*");
    ClassLoader::import("unittest.*");
    ClassLoader::import("testdir.*");
    ClassLoader::import('unittest.UnitTest');
    chdir($cd);
    define('TEST_INITIALIZED', true);
    ClassLoader::import('application.LiveCart');
    UnitTest::setApplication(new LiveCart());
    UnitTest::getApplication()->getConfig()->setAutoSave(false);
    UnitTest::getApplication()->getConfig()->set('EMAIL_METHOD', 'FAKE');
}
ClassLoader::import('application.system.*');
ClassLoader::import('library.locale.Locale');
ClassLoader::import('test.mock.Swift_Connection_Fake');
require_once 'LiveCartTest.php';
开发者ID:saiber,项目名称:livecart,代码行数:31,代码来源:Initialize.php

示例2: microtime

            $stat = $_REQUEST['stat'];
        }
        $start = microtime(true);
        ClassLoader::load($className);
        $elapsed = microtime(true) - $start;
        if (empty($GLOBALS['ClassLoaderTime'])) {
            $GLOBALS['ClassLoaderTime'] = $GLOBALS['ClassLoaderCount'] = 0;
        }
        $GLOBALS['ClassLoaderTime'] += $elapsed;
        $GLOBALS['ClassLoaderCount']++;
    }
}
require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'ClassLoader.php';
ClassLoader::mountPath('.', dirname(dirname($_SERVER["SCRIPT_FILENAME"])) . DIRECTORY_SEPARATOR);
if (defined('CACHE_DIR')) {
    ClassLoader::mountPath('cache', CACHE_DIR);
}
$classLoaderCacheFile = ClassLoader::getRealPath('cache.') . 'classloader.php';
if (file_exists($classLoaderCacheFile)) {
    $classLoaderCache = (include $classLoaderCacheFile);
    ClassLoader::setRealPathCache($classLoaderCache['realPath']);
    ClassLoader::setMountPointCache($classLoaderCache['mountPoint']);
}
if (isset($_REQUEST['stat'])) {
    ClassLoader::import('library.stat.Stat');
    $stat = new Stat(true);
    $GLOBALS['stat'] = $stat;
}
ClassLoader::import('framework.request.Request');
ClassLoader::import('framework.request.Router');
ClassLoader::import('framework.controller.*');
开发者ID:GregerA,项目名称:livecart,代码行数:31,代码来源:Initialize.php

示例3: dirname

<?php

/**
 * Integry framework bootstrap
 *
 * @package framework
 * @author Integry Systems
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ClassLoader.php';
// we're assuming that application root is one level above the framework directory
// if it's not the case, call ClassLoader::mountPath('.', '/path/to/the/root/directory');
ClassLoader::mountPath('.', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
ClassLoader::mountPath('framework', dirname(__FILE__) . DIRECTORY_SEPARATOR);
ClassLoader::import('framework.request.*');
ClassLoader::import('framework.renderer.*');
ClassLoader::import('framework.response.*');
ClassLoader::import('framework.controller.*');
ClassLoader::import('framework.Application');
$app = new Application();
// initialize default routing rules
$router = $app->getRouter();
$rules = array(array(":controller", array("action" => "index"), array()), array(":controller/:id", array("action" => "index"), array("id" => "-?[0-9]+")), array(":controller/:action", array(), array()), array(":controller/:action/:id", array(), array("id" => "-?[0-9]+")));
foreach ($rules as $route) {
    $router->connect($route[0], $route[1], $route[2]);
}
return $app;
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:Initialize.php


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