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

PHP lib函数代码示例

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

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



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

示例1: __construct

 /**
  * Construct the class.
  *
  * @return void
  */
 public function __construct($name = null)
 {
     $name = is_null($name) ? 'cart' : $name;
     $this->session = session('cart.' . $name);
     $this->collection = lib('items');
     $this->setCart($name);
 }
开发者ID:schpill,项目名称:standalone,代码行数:12,代码来源:cart.php


示例2: getAffiliation

 public function getAffiliation($reseller_id, $array = true)
 {
     $metiers = Model::Segmentreseller()->where(['reseller_id', '=', (int) $reseller_id])->with('segment');
     $out = $marches = [];
     foreach ($metiers as $metier) {
         if (isset($metier['segment'])) {
             switch ($metier['segment']['id']) {
                 case 413:
                     $marches[413] = ['id' => 413, 'name' => $metier['segment']['name']];
                     $opt_data = lib('forms')->getOptionsMacroData(413);
                     if (isAke($opt_data, 'affiliation_resto', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'resto';
                     } elseif (isAke($opt_data, 'affiliation_snack', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'snack';
                     } elseif (isAke($opt_data, 'affiliation_vin', null) == 1) {
                         $marches[413]['name'] = $marches[413]['name'] . ' ' . 'vin';
                     }
                     break;
                 default:
                     $seg = repo('segment')->getFamilyFromItem($metier['segment']['id']);
                     if (isset($seg[0]['id'])) {
                         $marches[$seg[0]['id']] = $seg[0];
                     }
             }
         }
     }
     $out['txt'] = '';
     $vir = '';
     foreach ($marches as $marche) {
         $out['txt'] = $vir . $marche['name'];
         $vir = ', ';
     }
     $out['tab'] = $marches;
     return $array ? $out['tab'] : $out['txt'];
 }
开发者ID:schpill,项目名称:standalone,代码行数:35,代码来源:segment.php


示例3: render

    function render(){
        $dom = lib('htmldom')->str_get_dom($this->inner);
        
        $head = '';
        $tabs = '';
        $iterator = 1;
        foreach ( $dom->find('tab') as $tab){
            $display = ($iterator==$this->selected)?'block':'none';
            $class = ($iterator==$this->selected)?'selected':'';

            $head .= "<a class='$class' href='javascript:;' onclick='
                $(this).parent().find(\"a\").removeClass(\"selected\");
                $(this).addClass(\"selected\");
                $(this).parent().parent().find(\".tabs_body\ .tab\").hide();
                $(this).parent().parent().find(\".tabs_body\ .tab:nth-child($iterator)\").show();
            '>$tab->title</a>";
            $tabs .= "<div style='display:$display;' class='tab'>$tab</div>";
            $iterator++;
        }
        ?>
        <div class="tabs">
            <div class="tabs_head"><?=$head?></div>
            <div class="tabs_body"><?=$tabs?></div>
        </div>
        <?
    }
开发者ID:nirgavish,项目名称:Framework--Apex,代码行数:26,代码来源:tabs.php


示例4: offreout

 public function offreout($reseller_id)
 {
     $collection = [];
     $advices = Model::Advice()->where(['table', '=', 'offreout'])->where(['reseller_id', '=', (int) $reseller_id])->where(['created_at', '>', strtotime(Config::get('advice.maxperiod', '-3 month'))])->cursor();
     foreach ($advices as $advice) {
         $account = Model::Account()->find((int) $advice['account_id']);
         if ($account) {
             $row = [];
             $row['id'] = $advice['id'];
             $row['positive'] = $advice['positive'];
             $row['negative'] = $advice['negative'];
             $row['account_id'] = $account->id;
             $row['firstname'] = $account->firstname;
             $rates = Model::Advicerate()->where(['advice_id', '=', (int) $advice['id']])->cursor();
             $row['rates'] = [];
             foreach ($rates as $rate) {
                 $category = Model::Adviceratecategory()->find((int) $rate['adviceratecategory_id']);
                 if ($category) {
                     $row['rates'][] = ['rate' => $rate['rate'], 'name' => $category['name'], 'order' => $category['order'], 'ponderation' => $category['ponderation']];
                 }
             }
             if (!empty($row['rates'])) {
                 $row['rates'] = array_values(lib('collection', [$row['rates']])->sortBy('order')->toArray());
             }
             $collection[] = $row;
         }
     }
     // return $collection;
     return empty($collection) ? [['id' => 1, 'account_id' => 28, 'firstname' => 'Pierre-Emmanuel', 'positive' => "Un accueil digne d'un 4 étoiles.", 'negative' => "Ma table était en plein courant d'air. Pas de pain en rab...", 'rates' => [['name' => 'Qualité', 'rate' => 6, 'ponderation' => 1], ['name' => 'Accueil', 'rate' => 8, 'ponderation' => 1], ['name' => 'Service', 'rate' => 8, 'ponderation' => 1]]], ['id' => 2, 'account_id' => 30, 'firstname' => 'Nicolas', 'positive' => "Très bon sommelier.", 'negative' => "Pas de parking à proximité.", 'rates' => [['name' => 'Qualité', 'rate' => 8, 'ponderation' => 1], ['name' => 'Accueil', 'rate' => 10, 'ponderation' => 1], ['name' => 'Service', 'rate' => 6, 'ponderation' => 1]]]] : $collection;
 }
开发者ID:schpill,项目名称:standalone,代码行数:30,代码来源:advice.php


示例5: boot

 public function boot()
 {
     spl_autoload_register(function ($class) {
         lib('middleware')->listen($class);
     });
     return $this;
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:middleware.php


示例6: user_create

function user_create($Username, $Password)
{
    global $pdo;
    if (user_exists($Username)) {
        return false;
    }
    $stmt = $pdo->prepare('
		INSERT INTO `users`
		(
			`username`
			, `password`
		) VALUES (
			:username
			, :password
		)');
    $stmt->bindValue(':username', s($Username));
    $stmt->bindValue(':password', user_hash($Password, $Username));
    $stmt->execute();
    $uid = $pdo->lastInsertId();
    $stmt->closeCursor();
    // Create a group for the new user
    lib('Group');
    $gid = group_create(s($Username), 'user');
    group_add($gid, $uid);
    return $uid;
}
开发者ID:ss23,项目名称:Pass-Store,代码行数:26,代码来源:User.php


示例7: __callStatic

 public static function __callStatic($m, $a)
 {
     if (!isset(self::$i)) {
         self::$i = lib('redys', ['blazz.store']);
     }
     return call_user_func_array([static::$i, $m], $a);
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:Staticstore.php


示例8: start

    function start($lifespan, $name=''){
        if ($this->fragment_name!=''){die('Nested fragment cache not supported.');}
        $x = debug_backtrace();

        if($name==''){
            $this->fragment_name = md5(lib('uri')->_selfURL().'||'.$x[0]['line']);
        }else{
            $this->fragment_name = $name;
        }
        ?><!-- START Fragment <?=$this->fragment_name?>--><?

        // if file does not exist, make preparations to cache and return true, so segment is executed
        if(!file_exists($this->fragment_path . $this->fragment_name)){
            $this->newly_cached = true;
            ob_start();
            return true;
        }else{
            // cache exists, let's see if it is still valid by checking it's age against the $lifespan variable
            $fModify = filemtime($this->fragment_path . $this->fragment_name);
            $fAge = time() - $fModify;
            if ($fAge > ($lifespan * 60)){
                // file is old, let's re-cache
                $this->newly_cached = true;
                ob_start();
                return true;
            }
            // no need to redo
            return false;
        }
    }
开发者ID:nirgavish,项目名称:Framework--Apex,代码行数:30,代码来源:cache.php


示例9: getInstance

 public static function getInstance($ns)
 {
     if (!isset(self::$collections[$ns])) {
         self::$collections[$ns] = lib('myiterator');
     }
     return self::$collections[$ns];
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:itemcollection.php


示例10: background

 public function background()
 {
     $file = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'scripts' . DS . 'later.php');
     if (File::exists($file)) {
         $cmd = 'php ' . $file;
         lib('utils')->backgroundTask($cmd);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:later.php


示例11: instance

 public static function instance($ns = 'core')
 {
     $i = isAke(self::$instances, $ns, false);
     if (!$i) {
         self::$instances[$ns] = $i = lib('now', [$ns]);
     }
     return $i;
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:nowstatic.php


示例12: __callStatic

 public static function __callStatic($f, $a)
 {
     $f = strtolower($f);
     if (!empty($a)) {
         return lib($f, $a);
     }
     return lib($f);
 }
开发者ID:schpill,项目名称:thin,代码行数:8,代码来源:Lib.php


示例13: session

function session($name = 'core', $adapter = 'session', $ttl = 3600)
{
    switch ($adapter) {
        case 'session':
            return lib('session', [$name]);
        case 'redis':
            return RedisSession::instance($name, $ttl);
    }
}
开发者ID:schpill,项目名称:jsoncms,代码行数:9,代码来源:helpers.php


示例14: SignUp

function SignUp($data)
{
    lib("users");
    if (is_string($res = CreateUser($data['username'], $data['password'], $data['email']))) {
        echo "<div class='error'>{$res}</div>" . PHP_EOL;
    } else {
        echo "Done. <a href='./'>Login</a> now." . PHP_EOL;
    }
}
开发者ID:p2004a,项目名称:CTF,代码行数:9,代码来源:signup.php


示例15: config

 private static function config()
 {
     Config::set('app.module.dir', __DIR__);
     Config::set('app.module.dirstorage', __DIR__ . DS . 'storage');
     lib('app');
     Alias::facade('Run', 'AppLib', 'Thin');
     Run::makeInstance();
     Config::set('directory.store', STORAGE_PATH);
 }
开发者ID:schpill,项目名称:blog,代码行数:9,代码来源:Bootstrap.php


示例16: page_404

 /**
  * 404错误页面
  */
 public function page_404()
 {
     lib()->load('menu')->add('menu', new \ULib\Menu());
     header("HTTP/1.1 404 Not Found");
     header("Content-Type:text/html; charset=utf-8");
     $this->__view('comm/header.php');
     $this->__view('home/404.html');
     $this->__view('comm/footer.php');
 }
开发者ID:Wanyor,项目名称:ProjectManager,代码行数:12,代码来源:Error.php


示例17: reset_password

 public function reset_password($user = NULL, $code = NULL)
 {
     lib()->load('UserControl');
     $uc = new UserControl();
     $this->theme->setTitle("密码重置");
     $this->__view("Home/header.php");
     $this->__view("Home/reset_password.php", ['user' => $user, 'code' => $code, 'status' => $uc->reset_password_check($user, $code)]);
     $this->__view("Home/footer.php");
 }
开发者ID:ttym7993,项目名称:Linger,代码行数:9,代码来源:Home.php


示例18: parseList

 private function parseList(&$list)
 {
     if (count($list) > 0) {
         lib()->load('Picture', 'Gallery');
         $pic = new Picture();
         $g = new Gallery();
         $pic->parsePic($list, false);
         $g->listAddTags($list);
     }
 }
开发者ID:ttym7993,项目名称:Linger,代码行数:10,代码来源:ListGallery.php


示例19: instance

 public static function instance($context = null)
 {
     $context = is_null($context) ? 'core' : $context;
     $has = Instance::has('ioc', $context);
     if (true === $has) {
         return Instance::get('ioc', $context);
     } else {
         $instance = lib('container');
         return Instance::make('ioc', $context, $instance);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:11,代码来源:ioc.php


示例20: get

 public function get($key, $model, $default = null)
 {
     if (!is_object($model)) {
         throw new Exception('the second argument must be a model.');
     }
     $cb = function ($key, $model, $default = null) {
         $option = Model::Opt()->where(['key', '=', (string) $key])->where(['object_id', '=', (int) $model->id])->where(['object_database', '=', (string) $model->_db->db])->where(['object_table', '=', (string) $model->_db->table])->first(true);
         return $option ? $option->value : $default;
     };
     return lib('utils')->remember("get.opt.{$model->id}.{$key}." . $model->_db->db . '.' . $model->_db->table, $cb, Model::Opt()->getAge(), [$key, $model, $default]);
 }
开发者ID:schpill,项目名称:standalone,代码行数:11,代码来源:option.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP lib2函数代码示例发布时间:2022-05-15
下一篇:
PHP li函数代码示例发布时间: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