当前位置: 首页>>代码示例>>PHP>>正文


PHP Q::ini方法代码示例

本文整理汇总了PHP中Q::ini方法的典型用法代码示例。如果您正苦于以下问题:PHP Q::ini方法的具体用法?PHP Q::ini怎么用?PHP Q::ini使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Q的用法示例。


在下文中一共展示了Q::ini方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionModify

 function actionModify()
 {
     $id = (int) $this->_context->get('id');
     $rs = Account::find('user_id = ?', $id)->getOne();
     if (!$rs->id()) {
         return $this->msg($tip = '参数错误', url('manage::account'));
     }
     $form = Form_Common::createForm('', 'manage/profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $is_locked = $post['is_locked'] ? '1' : '0';
         #dump($post);
         if ($user_pass) {
             $user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
             $rs->user_pass;
         }
         $rs->user_mail = $user_mail;
         $rs->is_locked = $is_locked;
         $rs->save();
         return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
     }
     $form->import($rs->toArray());
     $form->element('user_pass')->value = '';
     $form->element('is_locked')->checked = $rs->is_locked;
     #dump($form->element('is_locked'));
     $this->_view['form'] = $form;
     $this->_view['rs'] = $rs;
     $order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
     $this->_view['order'] = $order;
     $this->_view['_UDI'] = 'manage::account/index';
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:33,代码来源:account_controller.php

示例2: _after_destroy

 protected function _after_destroy()
 {
     $dir = rtrim(Q::ini('appini/teapics/upload_dir'), '/\\') . DS;
     if ($this->ico->value != null) {
         @unlink($dir . $this->ico);
     }
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:7,代码来源:links.php

示例3: render

 /**
  * 实现接口
  *
  */
 function render()
 {
     //得到子菜单的标题
     $menu_title = $this->_extract('menu');
     //的到子菜单的属性
     $sub_menu = Q::ini('appini/admin_sub_menus/' . $menu_title);
     //是否存在
     if (!is_array($sub_menu)) {
         $sub_menu = array();
     }
     //得到当前的属性
     $currentmenu = $this->_extract('current');
     //输出子菜单 如果是当前的加上css
     $out = "<ul>\n";
     foreach ($sub_menu as $menu) {
         //是否是当前菜单
         if ($menu['title'] == $currentmenu) {
             $out .= "<li class=\"current\">";
         } else {
             $out .= "<li>";
         }
         $out .= '<a href="' . url($menu['udi']) . '"> <span>';
         $out .= h($menu['title']) . '</span>';
         $out .= "</a></li>\n";
     }
     $out .= "</ul>\n";
     return $out;
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:32,代码来源:smalltabs.php

示例4: loadCached

 /**
  * 载入缓存的 YAML 解析结果,如果缓存失效,则重新解析并生成缓存
  *
  * 用法:
  * @code php
  * $arr = Helper_YAML::loadCached($filename);
  * @endcode
  *
  * $replace 参数的用法参考 load() 方法。
  *
  * @param string $filename 要解析的 yaml 文件名
  * @param array $replace 对于 YAML 内容要进行自动替换的字符串对
  * @param string $cache_backend 要使用的缓存后端
  *
  * @return array 解析结果
  * @throw Q_FileNotFoundException
  */
 static function loadCached($filename, array $replace = null, $cache_backend = null)
 {
     static $cache_obj = null;
     if (!is_file($filename)) {
         throw new Q_FileNotFoundException($filename);
     }
     $policy = array('lifetime' => 86400, 'serialize' => true);
     $mtime = filemtime($filename);
     $id = 'yaml_cache_' . md5($filename);
     if (is_null($cache_backend)) {
         if (is_null($cache_obj)) {
             $cache_obj = Q::singleton(Q::ini('runtime_cache_backend'));
         }
         $cache = $cache_obj;
     } else {
         $cache = Q::singleton($cache_backend);
     }
     /* @var $cache QCache_File */
     $data = $cache->get($id, $policy);
     if (!isset($data['yaml']) || empty($data['mtime']) || $data['mtime'] < $mtime) {
         // 缓存失效
         $data = array('mtime' => $mtime, 'yaml' => self::load($filename, $replace));
         $cache->set($id, $data, $policy);
     }
     return $data['yaml'];
 }
开发者ID:BGCX262,项目名称:zys-blog-svn-to-git,代码行数:43,代码来源:yaml.php

示例5: UserAclRoles

 function UserAclRoles($user_id = '')
 {
     $show_box['title'] = '获取用户全部角色';
     $return_value = '';
     $roles_idname = array();
     $roles_id = array();
     $sp_roles = Q::ini('appini/sp_role');
     // 第一步:直接从中间表获得用户的全部角色ID
     $user_roles = UsersHaveRoles::find('user_id = ?', intval($user_id))->asArray()->getAll();
     //dump($user_roles);
     // 取出有用的ID,去除deny的ID
     foreach ($user_roles as $value) {
         if ($value['is_include']) {
             $roles_id[] = $value['role_id'];
         }
     }
     //dump ( $roles_id);
     $roles_arr = Roles::find('role_id in (?)', Q::normalize($roles_id, ","))->asArray()->getAll();
     foreach ($roles_arr as $value) {
         $roles_idname[$value['role_id']] = $value['rolename'];
     }
     //dump($roles_idname);
     if (in_array($sp_roles['REPEAL'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['REPEAL']);
         return $return_value;
     } elseif (in_array($sp_roles['FREEZE'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['FREEZE']);
         return $return_value;
     } elseif (in_array($sp_roles['UNCHECKED'], $roles_idname)) {
         $return_value = array($value['role_id'] => $sp_roles['UNCHECKED']);
         return $return_value;
     } else {
         return $roles_idname;
     }
 }
开发者ID:Debenson,项目名称:openwan,代码行数:35,代码来源:acl.php

示例6: __construct

 function __construct()
 {
     $dsn = Q::ini('db_dsn_pool/default');
     if (empty($dsn)) {
         Q::changeIni('db_dsn_pool/default', Q::ini('db_dsn_mysql'));
     }
     parent::__construct();
 }
开发者ID:BGCX262,项目名称:zys-blog-svn-to-git,代码行数:8,代码来源:links.php

示例7: _before_execute

 protected function _before_execute()
 {
     parent::_before_execute();
     $this->_user = Account::find('user_id = ?', $this->_user_id)->getOne();
     if (!in_array($this->_user->user_mail, Q::ini('appini/managers'))) {
         return $this->msg('请先登陆', url('default::default/signin'));
     }
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:8,代码来源:manage.php

示例8: __construct

 /**
  * 构造函数
  *
  * @param 默认的缓存策略 $default_policy
  */
 function __construct(array $default_policy = null)
 {
     if (!is_null($default_policy)) {
         $this->_default_policy = array_merge($this->_default_policy, $default_policy);
     }
     if (empty($this->_default_policy['cache_dir'])) {
         $this->_default_policy['cache_dir'] = Q::ini('runtime_cache_dir');
     }
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:14,代码来源:file.php

示例9: setUp

 protected function setUp()
 {
     $dsn = Q::ini('db_dsn_pool/default');
     if (empty($dsn)) {
         Q::changeIni('db_dsn_pool/default', Q::ini('db_dsn_mysql'));
     }
     $conn = QDB::getConn();
     $params = array('name' => 'posts', 'pk' => 'post_id', 'conn' => $conn);
     $this->table = new QDB_Table($params);
 }
开发者ID:Debenson,项目名称:openwan,代码行数:10,代码来源:table.php

示例10: testCleanIni

 /**
  * 测试清除设置
  */
 function testCleanIni()
 {
     $path = 'node/single-value';
     Q::cleanIni($path);
     $test = Q::ini($path);
     $this->assertTrue(empty($test), "Q::ini('{$path}') == empty");
     $path = 'node';
     Q::cleanIni($path);
     $test = Q::ini($path);
     $this->assertTrue(empty($test), "Q::ini('{$path}') == empty");
 }
开发者ID:Debenson,项目名称:openwan,代码行数:14,代码来源:config.php

示例11: createForm

 static function createForm($id, $action)
 {
     $form = new Form_Admin_Links($id, $action);
     $form->add(QForm::ELEMENT, 'name', array('_ui' => 'textbox', '_label' => '友情链接名称', '_req' => true, '_tips' => '友情链接的网站名'))->add(QForm::ELEMENT, 'url', array('_ui' => 'textbox', '_label' => '网站地址', '_req' => true, '_tips' => '友情链接网站的网址'))->add(QForm::ELEMENT, 'link_id', array('_ui' => 'hidden'))->add(QForm::ELEMENT, 'img', array('_ui' => 'admin_picpreview', '_label' => '已上传图片', 'attr' => array('dir' => 'links')))->add(QForm::ELEMENT, 'ico', array('_ui' => 'upload', '_label' => '上传图标', '_tips' => ''))->add(QForm::ELEMENT, 'order_num', array('_ui' => 'textbox', '_label' => '排序', 'value' => 0));
     $form->addValidations(Links::meta());
     //上传图片的限制
     $types = Q::normalize(Q::ini('appini/teapics/upload_allowed_types'));
     $size = intval(Q::ini('appini/teapics/upload_allowed_size') * 1024);
     $dim = Q::ini('appini/teapics/img_pic_width') . 'x' . Q::ini('appini/teapics/img_pic_height');
     $form['ico']->_tips = sprintf($form['ico']->_tips, implode('/', $types), $size / 1024, $dim);
     $form->selectUploadElement('ico')->uploadAllowedSize($size)->uploadAllowedTypes($types)->enableSkipUpload();
     //表单验证规则
     return $form;
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:14,代码来源:links.php

示例12: generate

 /**
  * 生成指定名称的模型
  *
  * @param string $model_name
  * @param string $table_name
  * @param QDB_Adapter_Abstract $dbo
  *
  * @return QGenerator_Model
  */
 function generate($model_name, $table_name, $dbo)
 {
     $class_name = $this->_normalizeClassName($model_name);
     $dir = rtrim($this->_module->moduleDir(), '/\\') . '/model';
     $path = $this->_classFilePath($dir, $class_name);
     $this->_logClean();
     if (file_exists($path)) {
         throw new Q_ClassFileExistsException($class_name, $path);
     }
     // 确定数据表名称
     $arr = explode('.', $table_name);
     if (isset($arr[1])) {
         $table_name = $arr[1];
         $schema = $arr[0] . '.';
     } else {
         $table_name = $arr[0];
         $schema = '';
     }
     if (is_null($dbo)) {
         $dsn = Q::ini('db_dsn_pool/default');
         $dbtype = $dsn['driver'];
         $objid = "dbo_{$dbtype}_" . md5(serialize($dsn));
         $dbo_class_name = 'QDB_Adapter_' . ucfirst($dbtype);
         $dbo = new $dbo_class_name($dsn, $objid);
     }
     $prefix = $dbo->getTablePrefix();
     if ($prefix && substr($table_name, 0, strlen($prefix)) == $prefix) {
         $table_name = substr($table_name, strlen($prefix));
     }
     $table_name = "{$schema}{$table_name}";
     $config = array('name' => $table_name, 'conn' => $dbo);
     $table = new QDB_Table($config);
     $meta = $table->columns();
     $pk = array();
     foreach ($meta as $field) {
         if ($field['pk']) {
             $pk[] = $field['name'];
         }
     }
     $data = array('class_name' => $class_name, 'table_name' => $table_name, 'meta' => $meta, 'pk' => $pk);
     $content = $this->_parseTemplate('model', $data);
     $this->_createFile($path, $content);
     return $this;
 }
开发者ID:Debenson,项目名称:openwan,代码行数:53,代码来源:model.php

示例13: _createFormConfig

 /**
  * 从配置文件中创建表单
  * @param string $action     表单的url	
  * @param string $configName  配置文件的名字
  * @return Form_Tea $form
  */
 protected static function _createFormConfig($action, $configName)
 {
     $form = new Form_Admin_Tea('tea_form', $action);
     $filename = rtrim(dirname(__FILE__), '/\\') . DS . $configName;
     $form->loadFromConfig(Helper_YAML::load($filename));
     $form->addValidations(Tea::meta());
     //图片的路径
     $form['thumb_filename']->dir = Q::ini('appini/teapics/img_dir');
     //上传图片的限制
     $types = Q::normalize(Q::ini('appini/teapics/upload_allowed_types'));
     $size = intval(Q::ini('appini/teapics/upload_allowed_size') * 1024);
     $dim = Q::ini('appini/teapics/img_pic_width') . 'x' . Q::ini('appini/teapics/img_pic_height');
     $form['postfile']->_tips = sprintf($form['postfile']->_tips, implode('/', $types), $size / 1024, $dim);
     //        茶叶类别
     //       $teatype = new TeaType();
     //       $form['type_id']->items=$teatype->list;
     $form->selectUploadElement('postfile')->uploadAllowedSize($size)->uploadAllowedTypes($types)->enableSkipUpload();
     return $form;
 }
开发者ID:BGCX262,项目名称:zxhproject-svn-to-git,代码行数:25,代码来源:tea.php

示例14: send

 static function send($subject, $body, $user_mail, $user_nick = '客户')
 {
     $cfg = Q::ini('appini/email_config');
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->SMTPDebug = false;
     $mail->SMTPAuth = $cfg['smtpauth'];
     $mail->SMTPSecure = $cfg['smtpsecure'];
     $mail->Host = $cfg['host'];
     $mail->Port = $cfg['port'];
     $mail->Username = $cfg['username'];
     $mail->Password = $cfg['password'];
     $mail->SetFrom($cfg['from_email'], $cfg['from_nick']);
     $mail->Subject = $subject;
     $mail->MsgHTML($body);
     $mail->AddAddress($user_mail, $user_nick);
     if (!$mail->Send()) {
         return $mail->ErrorInfo;
     } else {
         return true;
     }
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:22,代码来源:api.php

示例15: actionIndex

 function actionIndex()
 {
     $account = QDB::getConn()->getOne($sql = "SELECT count(`groupname`) as total FROM radusergroup WHERE groupname =  'NOR'");
     $this->_view['account'] = $account;
     if (15 - $account < 1) {
         $this->_view['_MSG'] = '目前产品已经卖光了,请填写您有效的邮箱,以便接收到货通知。';
     }
     $rs = $this->_user;
     $form = Form_Common::createForm('', 'profile');
     if ($this->_context->isPOST() && $form->validate($_POST)) {
         $post = $form->values();
         $user_mail = $post['user_mail'];
         $user_pass = $post['user_pass'];
         $msg = null;
         if ($user_pass) {
             if ($user_pass != $post['user_pass_checked']) {
                 $msg = '两次密码输入不一致;';
             }
         }
         if ($msg === null) {
             if (!Q::ini('isDemo')) {
                 $rs->user_pass = sha1(md5('sike' . $user_pass . Q::ini('appini/secret_key')));
                 $rs->save();
                 return $this->msg('修改成功。', url('default::account/index'));
             }
             $msg = '演示用户禁止修改密码';
         }
         $this->_view['_MSG'] = $msg;
     }
     #$form->add(QForm::ELEMENT, $prop, array('_ui' => 'dropdownlist','_label'=>$label_text . ':', 'class' => 'slt toggle_input'));
     #$elem = $form->element($prop);
     $this->_view['_META_TITLE'] = '我的账户';
     $form->element('user_mail')->value = $rs->user_mail;
     $form->element('user_mail')->disabled = 'disabled';
     $this->_view['form'] = $form;
 }
开发者ID:xyz12810,项目名称:xiao3vpn,代码行数:36,代码来源:account_controller.php


注:本文中的Q::ini方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。