本文整理汇总了PHP中Setting::getApplicationPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getApplicationPath方法的具体用法?PHP Setting::getApplicationPath怎么用?PHP Setting::getApplicationPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setting
的用法示例。
在下文中一共展示了Setting::getApplicationPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load($module)
{
$m = explode(".", $module);
if (count($m) == 2 && $m[1] != '') {
$name = lcfirst($m[1]);
$class = ucfirst($name) . "Module";
$basePath = $m[0] == "app" ? Setting::getAppPath() : Setting::getApplicationPath();
$alias = ($m[0] == "app" ? 'app' : 'application') . ".modules.{$name}.{$class}";
$path = $basePath . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $name;
$classPath = $path . DIRECTORY_SEPARATOR . $class . ".php";
$this->name = $name;
$this->alias = $alias;
$this->path = $path;
$this->classPath = $classPath;
if (is_file($this->classPath)) {
$this->module = ModuleGenerator::init($alias, 'load');
$this->accessType = $this->module->checkAccessType();
$this->defaultRule = $this->module->defaultRule;
$this->rolesRule = $this->module->rolesRule;
$this->usersRule = $this->module->usersRule;
$this->acSource = $this->module->acSource;
$this->imports = $this->module->loadImport();
} else {
$this->module = null;
}
}
}
示例2: getConfigPath
public static function getConfigPath()
{
return Setting::getApplicationPath() . DIRECTORY_SEPARATOR . "config";
}
示例3: parseModule
public static function parseModule($module)
{
$m = explode(".", $module);
if (count($m) == 2 && $m[1] != '') {
$name = lcfirst($m[1]);
$class = ucfirst($name) . "Module";
$basePath = $m[0] == "app" ? Setting::getAppPath() : Setting::getApplicationPath();
$alias = ($m[0] == "app" ? 'app' : 'application') . ".modules.{$name}.{$class}";
$path = $basePath . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $name;
$classPath = $path . DIRECTORY_SEPARATOR . $class . ".php";
if (!Helper::isValidVar($class)) {
return [];
}
return ['name' => $name, 'class' => $class, 'alias' => $alias, 'path' => $path, 'classPath' => $classPath];
}
return [];
}
示例4: createIndexFile
public static function createIndexFile($mode = "install")
{
$path = Setting::getApplicationPath() . DIRECTORY_SEPARATOR . "index.php";
$file = file_get_contents($path);
$file = str_replace(['$mode = "init"', '$mode = "install"', '$mode = "running"'], '$mode = "' . $mode . '"', $file);
Setting::$mode = $mode;
if (!is_file($path)) {
return @file_put_contents(Setting::getRootPath() . DIRECTORY_SEPARATOR . "index.php", $file);
} else {
$oldpath = Setting::getRootPath() . DIRECTORY_SEPARATOR . "index.php";
$oldfile = @file_get_contents($oldpath);
if ($oldfile != $file) {
return @file_put_contents($oldpath, $file);
} else {
return true;
}
}
}
示例5: InstallModule
<?php
if (Setting::$mode == "init" || Setting::$mode == "install") {
Yii::import("application.modules.install.*");
Yii::import("application.modules.install.controllers.*");
$module = new InstallModule("install", null);
$controller = new DefaultController("default", $module);
$controller->action = $controller->createAction("index");
$msg = @$data['message'];
if (strpos(@$data['message'], 'Application Runtime Path') === 0) {
$msg = null;
}
$controller->action->runWithParams(['msg' => $msg]);
} else {
Yii::import("application.controllers.*");
$controller = new SiteController("site");
$controller->action = $controller->createAction("error");
$controller->action->run();
if (!@$_GET['rendered']) {
include Setting::getApplicationPath() . DIRECTORY_SEPARATOR . "framework" . DIRECTORY_SEPARATOR . "views" . DIRECTORY_SEPARATOR . "exception.php";
}
}