• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP option函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中option函数的典型用法代码示例。如果您正苦于以下问题:PHP option函数的具体用法?PHP option怎么用?PHP option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: password_form

function password_form($output = '')
{
    if (empty($id = get_the_ID())) {
        return $output;
    }
    return sprintf('%1$s<form action="%2$s" class="%3$s" method="post"><label for="%4$s" class="screen-reader-text">%5$s</label><input name="post_password" id="%4$s" type="password" size="20" required=""%6$s/><button id="submit" type="submit" name="submit"%7$s>%8$s</button></form>', sprintf('<p>%s</p>', esc_html(option('prompt'))), esc_url(site_url('wp-login.php?action=postpass', 'login_post')), option('class'), esc_attr('password-input-' . intval($id)), esc_html__('Password', 'ubik'), option('input_style') ? ' style="' . esc_attr(option('input_style')) . '"' : '', option('button_style') ? ' style="' . esc_attr(option('button_style')) . '"' : '', option('button'));
}
开发者ID:synapticism,项目名称:ubik,代码行数:7,代码来源:password-form.php


示例2: delete

 public static function delete($file)
 {
     if (empty($file)) {
         return false;
     }
     if (function_exists('option')) {
         $bucket = option('config.attachment_up_bucket');
         $user = option('config.attachment_up_username');
         $pwd = option('config.attachment_up_password');
         $unlink = option('config.attachment_upload_unlink');
     } else {
         $bucket = C('config.attachment_up_bucket');
         $user = C('config.attachment_up_username');
         $pwd = C('config.attachment_up_password');
         $unlink = C('config.attachment_upload_unlink');
     }
     if (empty($bucket) || empty($user) || empty($pwd)) {
         return false;
     }
     if (empty($unlink)) {
         return false;
     }
     $upyun = new UpYun($bucket, $user, $pwd);
     try {
         error_log('upyunUser::delete:' . $file);
         $upyun->delete($file);
     } catch (Exception $e) {
         print_r($e);
     }
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:30,代码来源:upyunUser.class.php


示例3: getListByProductId

 /**
  * 根据产品ID获得优惠活动
  * $product_id_arr 产品ID数组
  * $store_id 店铺ID
  * $uid 店铺UID
  */
 public function getListByProductId($product_id_arr, $store_id, $uid)
 {
     $tmp_product_id_arr = array();
     foreach ($product_id_arr as $tmp) {
         $tmp_product_id_arr[] = $tmp['product_id'];
     }
     $time = time();
     $db_prefix = option('system.DB_PREFIX');
     $sql = "SELECT distinct u.* FROM `" . $db_prefix . "user_coupon` AS u LEFT JOIN `" . $db_prefix . "coupon_to_product` AS cp ON `u`.`coupon_id` = `cp`.`coupon_id` WHERE `u`.`store_id` = '" . $store_id . "' AND (`u`.`is_all_product` = 0 or `cp`.`product_id` in (" . join(',', $tmp_product_id_arr) . ")) AND `u`.`uid` = '" . $uid . "' AND `u`.`start_time` <= '" . $time . "' AND `u`.`end_time` >= '" . $time . "' AND `u`.`is_use` = '0' AND `u`.is_valid = '1' AND `u`.`delete_flg` = '0'";
     $user_coupon_list = $this->db->query($sql);
     foreach ($user_coupon_list as &$user_coupon) {
         $where = array();
         $where['coupon_id'] = $user_coupon['coupon_id'];
         // 优惠参加产品
         if ($user_coupon['is_all_product'] == 1) {
             $product_list = M('Coupon_to_product')->getList($where);
             $product_id_arr = array();
             foreach ($product_list as $tmp) {
                 $product_id_arr[$tmp['product_id']] = $tmp['product_id'];
             }
             $user_coupon['product_list'] = $product_id_arr;
         } else {
             $user_coupon['product_list'] = array();
         }
     }
     return $user_coupon_list;
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:33,代码来源:user_coupon_model.php


示例4: getListByProductId

 /**
  * 根据产品ID获得优惠活动
  * $product_id_arr 产品ID数组
  * $store_id 店铺ID
  * $uid 店铺UID
  */
 public function getListByProductId($product_id_arr, $store_id, $uid)
 {
     $time = time();
     $db_prefix = option('system.DB_PREFIX');
     $sql = "SELECT distinct r.* FROM `" . $db_prefix . "reward` AS r LEFT JOIN `" . $db_prefix . "reward_product` AS rp ON `r`.`id` = `rp`.`rid` WHERE `r`.`store_id` = '" . $store_id . "' AND (`r`.`is_all` = 1 or `rp`.`product_id` in (" . join(',', $product_id_arr) . ")) AND `r`.`uid` = '" . $uid . "' AND `r`.`status` = '1' AND `r`.`start_time` <= '" . $time . "' AND `r`.`end_time` >= '" . $time . "'";
     $reward_list = $this->db->query($sql);
     foreach ($reward_list as &$reward) {
         $where = array();
         $where['rid'] = $reward['id'];
         // 优惠条件
         $reward_condition_list = M('Reward_condition')->getList($where, 0, 0, 'id desc');
         $reward['condition_list'] = $reward_condition_list;
         // 优惠参加产品
         if ($reward['is_all'] == 2) {
             $reward_product_list = M('Reward_product')->getList($where);
             $product_id_arr = array();
             foreach ($reward_product_list as $tmp) {
                 $product_id_arr[$tmp['product_id']] = $tmp['product_id'];
             }
             $reward['product_list'] = $product_id_arr;
         } else {
             $reward['product_list'] = array();
         }
     }
     return $reward_list;
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:32,代码来源:reward_model.php


示例5: configure

function configure()
{
    option('views_dir', APP_ROOT . '/views');
    option('lib_dir', APP_ROOT . '/lib');
    option('base_uri', '/');
    option('debug', false);
}
开发者ID:kematzy,项目名称:php-vs-sinatra-memory-usage-app,代码行数:7,代码来源:index.php


示例6: get_posts

function get_posts($query)
{
    if (is_tax('series') && $query->is_main_query()) {
        $query->set('order', option('order'));
    }
    return $query;
}
开发者ID:synapticism,项目名称:ubik,代码行数:7,代码来源:series.php


示例7: setUp

 /**
  * setUp.
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $view = new View();
     $view->theme(option('front_theme'));
     $this->helper = new MenuHelper($view);
 }
开发者ID:quickapps-plugins,项目名称:menu,代码行数:12,代码来源:MenuHelperTest.php


示例8: configure

function configure()
{
    $cfg = ActiveRecord\Config::instance();
    $cfg->set_model_directory("models");
    $cfg->set_connections(array("development" => "mysql://benchmarkdbuser:benchmarkdbpass@localhost/hello_world?charset=utf8"));
    option("bas_url", "/");
}
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:7,代码来源:index.php


示例9: filteredgrid

 function filteredgrid()
 {
     $this->datasis->modulo_id(106, 1);
     $this->rapyd->load("datafilter", "datagrid");
     //
     $filter = new DataFilter("Filtro por Partidas", "partida");
     $filter->id_part = new inputField("Identificador", "id_part");
     $filter->id_part->size = 5;
     $filter->part_pres = new inputField("C&oacute;digo", "part_pres");
     $filter->part_pres->size = 5;
     $filter->nomb_part = new inputField("Nombre", "nomb_part");
     $filter->nomb_part->size = 40;
     $filter->conf_part = new dropdawnField("Condici&oacute;n", "conf_part");
     $filter->conf_part = option('S', 'Si');
     $filter->conf_part = option('N', 'Ni');
     $filter->nro_cta->style = 'width:300px;';
     $filter->buttons("reset", "search");
     $filter->build();
     $uri = anchor('presupuesto/partida/dataedit/show/<#id_unid#>', '<#id_unid#>');
     $grid = new DataGrid("Lista de Unidades Ejecutoras");
     $grid->order_by("cod_unid", "asc");
     $grid->column("Identificador", $uri, "align='left'");
     $grid->column("Unidades Ejecutoras", "cod_unid", "align='left'");
     $grid->column("Nombre", "nomb_unid", "align='left'");
     $grid->add("presupuesto/partida/dataedit/create");
     $grid->build();
     $data['content'] = $filter->output . $grid->output;
     $data['title'] = " Partidas ";
     $data["head"] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:31,代码来源:partida.php


示例10: configure

function configure()
{
    option('views_dir', '../app/views');
    option('controllers_dir', '../app/controllers');
    option('encoding', 'utf-8');
    layout('layouts/default.html.php');
}
开发者ID:jbgh2,项目名称:limonade-scaffold,代码行数:7,代码来源:environment.php


示例11: redirect

function redirect()
{
    global $wp_rewrite;
    if (!is_search() || is_admin() || !isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->get_search_permastruct()) {
        return;
    }
    // Set the search base and query
    $search_base = $wp_rewrite->search_base;
    $search_query = get_query_var('s');
    // Skip the search results if there is exactly one result: http://wpglee.com/2011/04/redirect-when-search-query-only-returns-one-match/
    if (option('redirect_single') && $search_query) {
        global $wp_query;
        if ($wp_query->post_count == 1) {
            wp_redirect(esc_url(trailingslashit(get_permalink($wp_query->posts['0']->ID))));
            exit;
        }
    }
    // Return a random post when an empty search query is entered
    // Allows the random results to be filtered (e.g. to limit to a particular category, post types, or anything else accepted by `get_posts`)
    if (option('redirect_random') && $search_query === '') {
        $random = get_posts(apply_filters('ubik_search_redirect_random_args', ['numberposts' => 1, 'orderby' => 'rand']));
        wp_redirect(esc_url(trailingslashit(get_permalink($random[0]->ID))));
        exit;
    }
    // "Nice search" rewrite; full credit to Mark Jaquith for this functionality: https://wordpress.org/plugins/nice-search/
    if (strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false && strpos($_SERVER['REQUEST_URI'], '&') === false) {
        //wp_redirect( esc_url( trailingslashit( home_url( "/{$search_base}/" . urlencode($search_query) ) ) ) );
        wp_redirect(get_search_link());
        exit;
    }
}
开发者ID:synapticism,项目名称:ubik,代码行数:31,代码来源:search.php


示例12: hydrate_model

function hydrate_model($file)
{
    if (is_file($file) && strpos($file, '.php')) {
        preg_match_all('/class\\s(\\S+)\\s/', read($file), $match);
        require $file;
        foreach ($match[1] as $klass) {
            $re = new \ReflectionClass($klass);
            switch ($re->getParentClass()->getName()) {
                case 'Servant\\Mapper\\Database':
                    status('hydrate', $file);
                    $dsn = option('database.' . $klass::CONNECTION);
                    $db = \Grocery\Base::connect($dsn);
                    $columns = $klass::columns();
                    $indexes = $klass::indexes();
                    if (!isset($db[$klass::table()])) {
                        $db[$klass::table()] = $columns;
                    }
                    \Grocery\Helpers::hydrate($db[$klass::table()], $columns, $indexes);
                    break;
                case 'Servant\\Mapper\\MongoDB':
                    status('hydrate', $file);
                    $dsn_string = \Servant\Config::get($klass::CONNECTION);
                    $database = substr($dsn_string, strrpos($dsn_string, '/') + 1);
                    $mongo = $dsn_string ? new \Mongo($dsn_string) : new \Mongo();
                    $db = $mongo->{$database ?: 'default'};
                    \Servant\Helpers::reindex($db->{$klass::table()}, $klass::indexes());
                    break;
                default:
                    break;
            }
        }
    }
}
开发者ID:hbnro,项目名称:habanero,代码行数:33,代码来源:functions.php


示例13: pay

 public function pay()
 {
     if (empty($this->pay_config['pay_weixin_appid']) || empty($this->pay_config['pay_weixin_mchid']) || empty($this->pay_config['pay_weixin_key'])) {
         return array('err_code' => 1, 'err_msg' => '微信支付缺少配置信息!请联系管理员处理或选择其他支付方式。');
     }
     if (empty($this->openid)) {
         return array('err_code' => 1, 'err_msg' => '没有获取到用户的微信资料,无法使用微信支付');
     }
     import('source.class.pay.Weixinnewpay.WxPayPubHelper');
     $jsApi = new JsApi_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
     $unifiedOrder = new UnifiedOrder_pub($this->pay_config['pay_weixin_appid'], $this->pay_config['pay_weixin_mchid'], $this->pay_config['pay_weixin_key']);
     $unifiedOrder->setParameter('openid', $this->openid);
     $unifiedOrder->setParameter('body', $this->order_info['order_no_txt']);
     $unifiedOrder->setParameter('out_trade_no', $this->order_info['trade_no']);
     $unifiedOrder->setParameter('total_fee', floatval($this->order_info['total'] * 100));
     $unifiedOrder->setParameter('notify_url', option('config.wap_site_url') . '/paynotice.php');
     $unifiedOrder->setParameter('trade_type', 'JSAPI');
     $unifiedOrder->setParameter('attach', 'weixin');
     $prepay_result = $unifiedOrder->getPrepayId();
     if ($prepay_result['return_code'] == 'FAIL') {
         return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['return_msg']);
     }
     if ($prepay_result['err_code']) {
         return array('err_code' => 1, 'err_msg' => '没有获取微信支付的预支付ID,请重新发起支付!<br/><br/>微信支付错误返回:' . $prepay_result['err_code_des']);
     }
     $jsApi->setPrepayId($prepay_result['prepay_id']);
     return array('err_code' => 0, 'pay_data' => $jsApi->getParameters());
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:28,代码来源:Weixin.class.php


示例14: add

 public function add()
 {
     if (isPost()) {
         return $this->_add();
     }
     $row = array('card' => m('Member')->getNewCard(option('member_unit')), 'shop_id' => session('shop_id'), 'level_discount' => '1', 'money' => '0.00', 'consume' => '0.00', 'point' => '0.00');
     $this->view()->assign('title', '新增会员')->assign('action', url('Member', 'add'))->assign('row', $row)->assign('my_shop', getMyShop())->assign('member_level', getMemberLevel())->display('member_form');
 }
开发者ID:frycnx,项目名称:jxc,代码行数:8,代码来源:Member.php


示例15: add

 public function add()
 {
     if (isPost()) {
         return $this->_add();
     }
     $row = array('sn' => m('Customer')->getNewSn(option('customer_unit')), 'shop_id' => session('shop_id'), 'discount' => '1', 'money' => '0.00', 'consume' => '0.00', 'point' => '0.00', 'offer' => '0.00', 'overdraft' => '0.00', 'status' => '1');
     $this->view()->assign('title', '新增客户')->assign('action', url('Customer', 'add'))->assign('row', $row)->assign('my_shop', getMyShop())->display('customer_form');
 }
开发者ID:frycnx,项目名称:jxc,代码行数:8,代码来源:Customer.php


示例16: public_url_for

function public_url_for($path)
{
    $args = func_get_args();
    $paths = array(option('base_path'));
    $paths[] = 'public';
    $paths = array_merge($paths, $args);
    return call_user_func_array('file_path', $paths);
}
开发者ID:artisonian,项目名称:limonade-mongo-starter,代码行数:8,代码来源:helpers.php


示例17: getFxProducts

 public function getFxProducts($order_id)
 {
     $products = $this->db->query("SELECT p.product_id,p.name,fop.cost_price,p.image,fop.quantity,fop.price,fop.sku_id,fop.sku_data,fop.comment FROM " . option('system.DB_PREFIX') . "fx_order_product fop, " . option('system.DB_PREFIX') . "product p WHERE fop.product_id = p.product_id AND fop.fx_order_id = '" . $order_id . "'");
     foreach ($products as &$tmp) {
         $tmp['image'] = getAttachmentUrl($tmp['image']);
     }
     return $products;
 }
开发者ID:fkssei,项目名称:pigcms10,代码行数:8,代码来源:fx_order_product_model.php


示例18: configure

function configure()
{
    option('root_dir', dirname(__DIR__));
    option('views_dir', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'views');
    option('controllers_dir', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'controllers');
    option('lib_dir', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'lib');
    option('public_dir', __DIR__);
}
开发者ID:hellogerard,项目名称:shop-apis,代码行数:8,代码来源:index.php


示例19: getPersUserData

 function getPersUserData()
 {
     $ci =& get_instance();
     if (!$ci->session->userdata("user_id")) {
         redirect(option("site_url") . "/security/login", "refresh");
         exit;
     }
 }
开发者ID:agamystar,项目名称:smart,代码行数:8,代码来源:options_helper.php


示例20: configure

function configure()
{
    option('env', ENV_PRODUCTION);
    option('debug', false);
    option('base_uri', '<TPL:NGINX_LOCATION>/');
    layout('layout.html.php');
    define('PUBLIC_DIR', '<TPL:NGINX_LOCATION>/public');
}
开发者ID:sheelarajeshkumar,项目名称:torclient_ynh,代码行数:8,代码来源:config.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP optionGet函数代码示例发布时间:2022-05-15
下一篇:
PHP optimizeSQLTable函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap