本文整理汇总了PHP中Symfony\Component\ClassLoader\UniversalClassLoader::useIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP UniversalClassLoader::useIncludePath方法的具体用法?PHP UniversalClassLoader::useIncludePath怎么用?PHP UniversalClassLoader::useIncludePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\ClassLoader\UniversalClassLoader
的用法示例。
在下文中一共展示了UniversalClassLoader::useIncludePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUseIncludePath
public function testUseIncludePath()
{
$loader = new UniversalClassLoader();
$this->assertFalse($loader->getUseIncludePath());
$this->assertNull($loader->findFile('Foo'));
$includePath = get_include_path();
$loader->useIncludePath(true);
$this->assertTrue($loader->getUseIncludePath());
set_include_path(__DIR__ . '/Fixtures/includepath' . PATH_SEPARATOR . $includePath);
$this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'includepath' . DIRECTORY_SEPARATOR . 'Foo.php', $loader->findFile('Foo'));
set_include_path($includePath);
}
示例2: UniversalClassLoader
<?php
require_once __DIR__ . '/../vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\ClassLoader\UniversalClassLoader;
$loader = new UniversalClassLoader();
// You can search the include_path as a last resort.
$loader->useIncludePath(true);
// ... register namespaces and prefixes here - see below
$loader->registerNamespaces(array('SagePHP' => __DIR__ . '/../src/'));
$loader->register();
示例3: implode
array_pop($urlParts);
return implode('/', $urlParts) . '/';
}
if (get_magic_quotes_gpc()) {
throw new Exception("magic_quotes_gpc is not supported");
}
/******************************************************************************
* Constants
*****************************************************************************/
define('ROOT_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
define('ROOT_URL', get_base_url());
ini_set("include_path", ROOT_PATH . 'libs' . DIRECTORY_SEPARATOR);
$loader = (require_once ROOT_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');
use Symfony\Component\ClassLoader\UniversalClassLoader;
$universalLoader = new UniversalClassLoader();
$universalLoader->useIncludePath(true);
$universalLoader->register();
require_once 'Zend/Db/Adapter/Mysqli.php';
/******************************************************************************
* Loading of the options (default & user)
*****************************************************************************/
if (!file_exists(ROOT_PATH . "options.php")) {
die("The file options.php should exists, please read the instructions inside of 'options.php-example'.");
}
require_once ROOT_PATH . "options_default.php";
require_once ROOT_PATH . "options.php";
/******************************************************************************
* Initialize all the global variables
*****************************************************************************/
require_once ROOT_PATH . '/services.php';
$g_database = new Zend_Db_Adapter_Mysqli($g_options['mysql']);