本文整理匯總了PHP中Director::BaseFolder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Director::BaseFolder方法的具體用法?PHP Director::BaseFolder怎麽用?PHP Director::BaseFolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Director
的用法示例。
在下文中一共展示了Director::BaseFolder方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
public function init()
{
parent::init();
// set the paths as the document root
$paths = array();
if (is_array($this->config()->paths)) {
foreach ($this->config()->paths as $path) {
$paths[] = Director::BaseFolder() . "/" . $path;
}
} elseif (is_string($this->config()->paths)) {
$paths[] = Director::BaseFolder() . "/" . $this->config()->paths;
}
// set the service
$this->setService($this->config()->service, $paths);
$this->setRequirements();
// load the fixture file
$this->loadFixture();
}
示例2: setService
/**
* Set the styleguide service on init.
* @param String $name The name of the styleguide service.
* @param String $paths Project base url.
*/
public function setService($name, $paths = null)
{
if (!$paths) {
// set the paths as the document root
$paths = array();
if (is_array($this->config()->paths)) {
foreach ($this->config()->paths as $path) {
$paths[] = Director::BaseFolder() . "/" . $path;
}
} elseif (is_string($this->config()->paths)) {
$paths[] = Director::BaseFolder() . "/" . $this->config()->paths;
}
}
$this->styleguide_service = Injector::inst()->create($name);
$this->styleguide_service->setURL($paths);
}