本文整理匯總了PHP中core\Config::Get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Config::Get方法的具體用法?PHP Config::Get怎麽用?PHP Config::Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core\Config
的用法示例。
在下文中一共展示了Config::Get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Instance
public static function Instance($database = NULL)
{
if (!isset(self::$instances[$database])) {
if (is_null($database)) {
$db_info = Config::Get('database');
} else {
$db_info = array('name' => $database);
}
$db_file = Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::DB_EXTENSION);
if (!file_exists($db_file)) {
$schema = file_get_contents(Config::Path(Config::DIR_DATA . DIRECTORY_SEPARATOR . $db_info['name'] . SQLite::INIT_EXTENSION));
$schema = str_replace("\n", ' ', $schema);
$schema = str_replace("\r", ' ', $schema);
$db = new SQLite3($db_file, SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
$db->exec($schema);
}
// load database
self::$instances[$database] = new PDO('sqlite:' . $db_file);
if (Config::Get('debug')) {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} else {
self::$instances[$database]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
}
self::$instances[$database]->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
}
self::$access++;
return self::$instances[$database];
}
示例2: Application
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Code source hosted on https://github.com/Devenet/MoodPicker
*/
set_include_path('./library');
spl_autoload_extensions('.php');
spl_autoload_register();
use Core\Application;
use Core\Config;
use Core\Setting;
use Utils\Menu;
use Manage\Authentification;
if (Config::Get('debug')) {
error_reporting(-1);
ini_set('display_errors', 1);
} else {
error_reporting(0);
ini_set('display_errors', 0);
}
$app = new Application();
$auth = new Authentification();
$navbar = new Menu();
$navbar->item($app->URL(), 'Share')->item($app->URL('review'), 'Review')->item($app->URL('details'), 'Details');
$navbar_right = new Menu();
if ((new Setting('api_display_doc'))->getValue() || $auth->isLogged()) {
$navbar_right->item($app->URL('api'), 'API');
} else {
if ((new Setting('api_requests'))->getValue()) {
示例3: display
protected function display()
{
try {
$this->template->draw($this->page);
} catch (\Rain\Tpl\NotFoundException $ex) {
if (Config::Get('debug')) {
$tpl = $ex->getTrace()[0]['args'][0] == 404 ? htmlspecialchars($_GET['template']) : $ex->getTrace()[0]['args'][0];
$this->assign('exception', $tpl);
}
header('HTTP/1.1 404 Not Found', TRUE, 404);
$this->template->assign('navbar', $this->modules[Menu::NAVBAR]->generate('404'));
$this->template->draw('_404');
}
}
示例4: __construct
private function __construct()
{
$this->themes = Config::Get('themes');
$this->theme = is_null(Config::Get('theme')) ? self::DEFAULT_THEME : Config::Get('theme');
}