本文整理匯總了PHP中zotop::db方法的典型用法代碼示例。如果您正苦於以下問題:PHP zotop::db方法的具體用法?PHP zotop::db怎麽用?PHP zotop::db使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zotop
的用法示例。
在下文中一共展示了zotop::db方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
if (!is_object($this->_db)) {
$this->_db = zotop::db();
}
$this->_user = zotop::user();
}
示例2: editAction
public function editAction($tablename)
{
if (form::isPostBack()) {
$tablename = request::post('tablename');
$name = request::post('name');
$comment = request::post('comment');
$primary = request::post('primary');
if (strtolower($tablename) !== strtolower($name)) {
$rename = zotop::db()->table($tablename)->rename($name);
}
if ($comment !== NULL) {
$comment = zotop::db()->table($name)->comment($comment);
}
if ($primary) {
$primary = zotop::db()->table($name)->primary($primary);
}
$this->success('數據表設置成功,正在刷新頁麵,請稍後……', zotop::url('database/table'));
}
$db = zotop::db();
$database = $db->config();
$tables = $db->tables(true);
$table = $tables[$tablename];
if (!isset($table)) {
$this->error(zotop::t('數據表{$tablename}不存在', array('tablename' => $tablename)));
}
$page = new dialog();
$page->title = '數據庫管理:' . $database['database'] . ' @ ' . $database['hostname'] . '<i>></i> 編輯:' . $tablename;
$page->set('database', $database);
$page->set('table', $table);
$page->display();
}
示例3: onDefault
public function onDefault()
{
$db = zotop::db();
if ($db->connect()) {
zotop::redirect('database/table');
}
msg::error('連接數據庫失敗', '請檢查數據庫配置是否正確');
}
示例4: actionIndex
public function actionIndex()
{
$db = zotop::db();
if ($db->connect()) {
zotop::redirect(zotop::url('database/table'));
}
msg::error('連接數據庫失敗,請檢查數據庫配置是否正確');
}
示例5: actionDelete
public function actionDelete($tablename)
{
$delete = zotop::db()->table($tablename)->drop();
if (!$delete) {
msg::error(zotop::t('刪除數據表{$tablename}失敗', array('tablename' => $tablename)));
}
msg::success('刪除成功', zotop::url('database/table'));
}
示例6: __construct
public function __construct()
{
$this->db = zotop::db();
//數據庫
if (!user::isLogin()) {
//url::redirect('system/login');
}
}
示例7: onDefault
public function onDefault()
{
$header['title'] = '控製中心';
page::header($header);
page::top();
page::navbar(array(array('id' => 'main', 'title' => '首頁', 'href' => url::build('zotop/index/main')), array('id' => 'info', 'title' => '係統信息', 'href' => url::build('zotop/index/info'))), 'main');
$db = zotop::db();
$user = $db->select('*')->from('user')->orderby('id', 'asc')->limit(1)->getAll();
zotop::dump($db->lastSql());
zotop::dump($user);
page::bottom('<span class="zotop-tip">最後一次登錄時間:2009-8-9 14:17:54</span>');
page::footer();
}
示例8: __construct
public function __construct()
{
if (!is_object($this->db)) {
$this->db = zotop::db();
}
}
示例9: __construct
public function __construct()
{
$this->db = zotop::db();
}
示例10: actionFulltext
public function actionFulltext($tablename, $fieldname)
{
$indexes = zotop::db()->table($tablename)->index();
if (isset($indexes[$fieldname])) {
zotop::db()->table($tablename)->index($fieldname, 'DROP');
}
$result = zotop::db()->table($tablename)->index($fieldname, 'FULLTEXT');
if ($result) {
msg::success('操作成功,已經成功的將該字段設置為全文索引', zotop::url('database/field/index', array('tablename' => $tablename)));
}
}
示例11: onDelete
public function onDelete($tablename)
{
$tables = zotop::db()->tables(true);
$table = $tables[$tablename];
if (!isset($table)) {
msg::error('參數錯誤', zotop::t('數據表{$tablename}不存在', array('tablename' => $tablename)));
}
$delete = zotop::db()->table($tablename)->drop();
msg::success('操作成功', '<h2>數據表刪除成功</h2>正在刷新頁麵,請稍後……', 'reload');
}
示例12:
</tr>
<tr>
<td class="w80">空間占用:</td><td><?php
echo zotop::config('site.size');
?>
</td>
</tr>
<tr>
<td class="w80">已上傳文件:</td><td><?php
echo zotop::config('upload.size');
?>
</td>
</tr>
<tr>
<td class="w80">數據庫大小:</td><td><?php
echo zotop::db()->size();
?>
</td>
</tr>
</table>
</div>
<div class="block-footer"></div>
</div>
<div class="block clearfix ">
<div class="block-header">
<h2>係統信息</h2>
<h3><a class="more" href="<?php
echo zotop::url('zotop/system/info');
?>
">詳細</a></h3>
</div>
示例13: onDelete
public function onDelete($tablename, $fieldname)
{
$fields = zotop::db()->table($tablename)->fields();
$field = $fields[$fieldname];
if (!isset($field)) {
msg::error('參數錯誤', zotop::t('數據表{$tablename}中找不到字段{$fieldname}', array('tablename' => $tablename, 'fieldname' => $fieldname)));
}
$delete = zotop::db()->table($tablename)->field($fieldname)->drop();
if (!$delete) {
}
msg::success('操作成功', '<h2>字段刪除成功</h2>正在刷新頁麵,請稍後……', 'reload');
}
示例14: onSystem
public function onSystem()
{
$header['title'] = '控製中心';
$phpinfo = array();
$server = $_SERVER['SERVER_ADDR'] . ' / ' . PHP_OS;
$php = $_SERVER['SERVER_SOFTWARE'];
$safemode = @ini_get('safe_mode') ? ' 開啟' : '關閉';
if (@ini_get('file_uploads')) {
$upload_max_filesize = ini_get('upload_max_filesize');
} else {
$upload_max_filesize = '<b class="red">---</b>';
}
$upload_filesize = format::byte(dir::size(ZOTOP_UPLOAD));
$database = zotop::db()->config();
$database['size'] = zotop::db()->size();
$database['version'] = zotop::db()->version();
$database['db'] = $database['hostname'] . ':' . $database['hostport'] . '/' . $database['database'];
page::header($header);
page::top();
page::navbar($this->navbar());
block::header('服務器信息');
table::header();
table::row(array('side 1 w60' => '服務器', 'main w300 1' => $server, 'side 2 w60 ' => 'WEB服務器', 'main 2' => $php));
table::row(array('side 1 w60' => '安全模式', 'main 1' => $safemode, 'side 2 w60 ' => 'PHP版本', 'main 2' => PHP_VERSION));
table::row(array('side 1 w60' => '程序版本', 'main 1' => zotop::config('zotop.version'), 'side 2 w60 ' => '程序根目錄', 'main 2' => ROOT));
table::footer();
block::footer();
block::header('文件夾權限<span>如果某個文件或目錄被檢查到“無法寫入”(以紅色列出),請即刻通過 FTP 或其他工具修改其屬性(例如設置為 777),以確保程序功能的正常使用</span>');
table::header();
table::row(array('side 1 w60' => '配置目錄', 'main w300 1' => '', 'side 2 w60 ' => '備份目錄', 'main 2' => ''));
table::row(array('side 1 w60' => '運行目錄', 'main w300 1' => '', 'side 2 w60 ' => '模塊目錄', 'main 2' => ''));
table::footer();
block::footer();
block::header('數據庫信息');
table::header();
table::row(array('side 1 w60' => '驅動名稱', 'main w300 1' => $database['driver'], 'side 2 w60 ' => '數據庫', 'main 2' => $database['db']));
table::row(array('side 1 w60' => '數據庫版本', 'main 1' => $database['version'], 'side 2 w60 ' => '占用空間', 'main 2' => $database['size']));
table::footer();
block::footer();
block::header('文件上傳');
table::header();
table::row(array('side 1 w60' => '上傳許可', 'main w300 1' => $upload_max_filesize, 'side 2 w60 ' => '已上傳文件', 'main 2' => '<span class="loading">' . $upload_filesize . '</span>'));
table::footer();
block::footer();
page::bottom();
page::footer();
}