本文整理汇总了PHP中Thin\File::create方法的典型用法代码示例。如果您正苦于以下问题:PHP File::create方法的具体用法?PHP File::create怎么用?PHP File::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thin\File
的用法示例。
在下文中一共展示了File::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($db)
{
$this->orm = $db;
$this->db = $db->db();
$this->table = $db->table();
$dir = Config::get('dir.blizz.store', session_save_path());
if (!is_dir($dir)) {
File::mkdir($dir);
}
$dir .= DS . Inflector::urlize(Inflector::uncamelize($this->db));
if (!is_dir($dir)) {
File::mkdir($dir);
}
$this->dir = $dir . DS . Inflector::urlize(Inflector::uncamelize($this->table));
if (!is_dir($this->dir)) {
File::mkdir($this->dir);
}
$file = $this->dir . DS . 'data.db';
$new = false;
if (!is_file($file)) {
File::create($file);
$new = true;
File::put($this->dir . DS . 'age.blizz', '');
}
$link = new SQLite3($file);
Now::set("blizz.link.{$this->db}.{$this->table}", $link);
if ($new) {
$this->init();
}
}
示例2: __construct
public function __construct($db, $table)
{
$file = Config::get('mlite.dir.' . $db, STORAGE_PATH . DS . $db . '.db');
$new = !is_file($file);
if (!is_file($file)) {
File::create($file);
}
$link = new SQLite3($file);
Now::set("lite.link.{$db}.{$table}", $link);
if ($new) {
$q = "CREATE TABLE IF NOT EXISTS infosdb (data_key VARCHAR PRIMARY KEY, data_value);";
$res = $link->exec($q);
}
$this->table = $table;
$this->database = $db;
}
示例3: __construct
/**
*
* @method __construct
*
* @param string
* @param array
*/
public function __construct(array $data = [])
{
$ns = $this->ns = $this->forever();
$file = Config::get('cachemelite.dir.' . $ns, STORAGE_PATH . DS . $ns . '_cache.db');
$new = !is_file($file);
if (!is_file($file)) {
File::create($file);
}
$db = new SQLite3($file);
Now::set("cachemelite.link.{$ns}", $db);
$q = "CREATE TABLE IF NOT EXISTS cachedb (data_key VARCHAR PRIMARY KEY, data_value);";
$res = $this->db->exec($q);
if (!empty($data)) {
foreach ($data as $k => $v) {
$this->set($k, $v);
}
}
}
示例4: __construct
public function __construct($viewFile = null)
{
if (null !== $viewFile) {
$this->_module = 'www';
if (strstr($viewFile, DS)) {
$this->_viewFile = $viewFile;
} else {
$file = CACHE_PATH . DS . md5($this->_viewFile . time() . Utils::UUID()) . '.fake';
File::create($file);
$fp = fopen($file, 'a');
fwrite($fp, '<?php echo $this->content; ?>');
$this->_viewFile = $file;
}
} else {
$route = Utils::get('appDispatch');
/* polymorphism */
$route = !$route instanceof Container ? container()->getRoute() : $route;
if ($route instanceof Container) {
$module = $route->getModule();
$controller = $route->getController();
$action = $route->getAction();
$this->_module = $module;
$isTranslate = Utils::get('isTranslate');
if (true === $isTranslate) {
$lng = getLanguage();
if (true === container()->getMultiSite()) {
$this->_viewFile = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($lng) . DS . Inflector::lower($action) . '.phtml';
} else {
$this->_viewFile = APPLICATION_PATH . DS . 'modules' . DS . SITE_NAME . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($lng) . DS . Inflector::lower($action) . '.phtml';
}
} else {
if (true === container()->getMultiSite()) {
$this->_viewFile = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($action) . '.phtml';
} else {
$this->_viewFile = APPLICATION_PATH . DS . 'modules' . DS . SITE_NAME . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($action) . '.phtml';
}
}
}
}
Utils::set('appView', $this);
Utils::set('showStats', true);
}
示例5: ThinLog
function ThinLog($message, $logFile = null, $type = 'info')
{
if (null === $logFile) {
$logFile = LOGS_PATH . DS . date('Y-m-d') . '.log';
} else {
if (false === File::exists($logFile)) {
File::create($logFile);
}
}
File::append($logFile, date('Y-m-d H:i:s') . "\t" . Inflector::upper($type) . "\t{$message}\n");
}