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


PHP using函数代码示例

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


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

示例1: convert

 public function convert($fv, $fc, $tc)
 {
     using('lepton.web.forex');
     $cc = new CurrencyExchange();
     $tv = $cc->convert($fv, $fc, $tc);
     console::writeLn("%0.2f %s = %0.2f %s", $fv, $fc, $tv, $tc);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:forex.php

示例2: test_using_two_disponsables_with_exceptions_calling_both_disposes

 function test_using_two_disponsables_with_exceptions_calling_both_disposes()
 {
     $disposeCalled = ['foo' => false, 'bar' => false];
     $foo = $this->getMockBuilder('Foo')->getMock();
     $foo->expects($this->any())->method('dispose')->will($this->returnCallback(function () use(&$disposeCalled) {
         $disposeCalled['foo'] = true;
     }));
     $foo->expects($this->any())->method('hello')->will($this->returnCallback(function () {
         throw new \Exception('hello function exception');
     }));
     $bar = $this->getMockBuilder('Bar')->getMock();
     $bar->expects($this->any())->method('dispose')->will($this->returnCallback(function () use(&$disposeCalled) {
         $disposeCalled['bar'] = true;
     }));
     $this->assertFalse($disposeCalled['foo'], 'Foo dispose has been called');
     $this->assertFalse($disposeCalled['bar'], 'Bar dispose has been called');
     try {
         using([$foo, $bar], function (Foo $foo, Bar $bar) {
             $foo->hello("Gonzalo");
             $bar->hello("Gonzalo");
         });
     } catch (\Exception $e) {
     }
     $this->assertTrue($disposeCalled['foo'], 'Foo dispose has been called');
     $this->assertTrue($disposeCalled['bar'], 'Bar dispose has been called');
 }
开发者ID:gonzalo123,项目名称:using,代码行数:26,代码来源:UsingTest.php

示例3: __construct

 function __construct()
 {
     using('lepton.web.captcha');
     using('lepton.mvc.request');
     using('lepton.mvc.response');
     using('lepton.mvc.session');
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:captcha.php

示例4: discover

 /**
  * @description Service Discovery
  */
 function discover()
 {
     using('lepton.net.httprequest');
     using('lepton.web.discovery');
     $d = Discovery::discover('http://127.0.0.1');
     $this->assertNotNull($d);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:10,代码来源:web.php

示例5: detail

 function detail()
 {
     global $G;
     using("area", "industry");
     $area = new Areas();
     $industry = new Industries();
     $tpl_file = "company/detail";
     $this->viewhelper->setTitle(L("yellow_page", "tpl"));
     $this->viewhelper->setPosition(L("yellow_page", "tpl"), "index.php?do=company");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $result = $area->dbstuff->GetRow("SELECT * FROM {$area->table_prefix}companies WHERE id='" . $id . "'");
         if (!empty($result)) {
             $login_check = 1;
             //default open
             if (isset($G['setting']['company_logincheck'])) {
                 $login_check = $G['setting']['company_logincheck'];
             }
             $this->viewhelper->setTitle($result['name']);
             $this->viewhelper->setPosition($result['name']);
             $result['tel'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['tel']));
             $result['fax'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['fax']));
             $result['mobile'] = pb_hidestr($result['mobile']);
             $result['industry_names'] = $industry->disSubNames($result['industry_id'], null, true, "company");
             $result['area_names'] = $area->disSubNames($result['area_id'], null, true, "company");
             setvar("item", $result);
             setvar("LoginCheck", $login_check);
         }
     }
     render($tpl_file, 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:company_controller.php

示例6: start

 /**
  * Magic Start method. When this method is invoked the job is to pick up
  * where it left off and resume or start the processing of the job.
  */
 function start()
 {
     $this->setState(LdwpJob::STATE_RUNNING, 0, 1, "Downloading " . $this->url);
     using('lepton.net.httprequest');
     $dl = new HttpRequest($this->url, array('saveto' => $this->destination, 'onprogress' => new Callback($this, 'onDownloadProgress')));
     $this->setState(LdwpJob::STATE_COMPLETED, 1, 1, "Saved " . $this->url);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:11,代码来源:download.php

示例7: broke

function broke()
{
    foreach (using(function () {
        (yield 1);
        (yield 2);
        (yield 3);
    }) as $x) {
        var_dump($x);
    }
}
开发者ID:n3b,项目名称:hiphop-php,代码行数:10,代码来源:inline_closure_gen.php

示例8: findClass

 protected function findClass($classpath)
 {
     if (strpos($classpath, '.') !== false) {
         using($classpath);
         $class = explode('.', $classpath);
         return $class[count($class) - 1];
     } else {
         return $classpath;
     }
 }
开发者ID:BackupTheBerlios,项目名称:php5cms-svn,代码行数:10,代码来源:TService.php

示例9: lists

 function lists()
 {
     global $viewhelper, $pos;
     using("industry", "area");
     $area = new Areas();
     $industry = new Industries();
     $conditions[] = "Job.status=1";
     $viewhelper->setTitle(L("hr_information", "tpl"));
     $viewhelper->setPosition(L("hr_information", "tpl"), "index.php?do=job&action=" . __FUNCTION__);
     if (!empty($_GET['q'])) {
         $title = trim($_GET['q']);
         $conditions[] = "Job.name like '%" . $title . "%'";
     }
     if (!empty($_GET['data']['salary_id'])) {
         $conditions[] = "Job.salary_id=" . intval($_GET['data']['salary_id']);
     }
     if (!empty($_GET['data']['area_id'])) {
         $conditions[] = "Job.area_id=" . intval($_GET['data']['area_id']);
     }
     if (isset($_GET['industryid'])) {
         $industry_id = intval($_GET['industryid']);
         $tmp_info = $industry->setInfo($industry_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.industry_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&industryid=" . $tmp_info['id']);
         }
     }
     if (isset($_GET['areaid'])) {
         $area_id = intval($_GET['areaid']);
         $tmp_info = $area->setInfo($area_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.area_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&areaid=" . $tmp_info['id']);
         }
     }
     $amount = $this->job->findCount(null, $conditions, "Job.id");
     $result = $this->job->findAll("Job.*,Job.cache_spacename AS userid,Job.created AS pubdate,(select Company.name from " . $this->job->table_prefix . "companies Company where Company.id=Job.id) AS companyname", null, $conditions, "Job.id DESC", $pos, $this->displaypg);
     $viewhelper->setTitle(L("search", "tpl"));
     $viewhelper->setPosition(L("search", "tpl"));
     setvar("items", $result);
     setvar("paging", array('total' => $amount));
     render("job/list", 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:45,代码来源:job_controller.php

示例10: add

 function add()
 {
     global $smarty;
     using("message");
     $pms = new Messages();
     if (isset($_POST['do']) && !empty($_POST['friendlink'])) {
         pb_submit_check('friendlink');
         $data = $_POST['friendlink'];
         $result = false;
         $data['status'] = 0;
         $data['created'] = $data['modified'] = $this->friendlink->timestamp;
         $result = $this->friendlink->save($data);
         if ($result) {
             $pms->SendToAdmin('', array("title" => $data['title'] . L("apply_friendlink"), "content" => $data['title'] . L("apply_friendlink") . "\n" . $_POST['data']['email'] . "\n" . $data['description']));
             flash('wait_apply');
         }
     } else {
         flash();
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:20,代码来源:friendlink_controller.php

示例11: request

 static function request($event, $data)
 {
     $qurl = $data['uri'];
     if (url($qurl)->like('/^\\/sts-rpc[\\/]?/')) {
         using('s2s.request');
         $cmd = request::get('cmd');
         $req = new S2SRequest(S2SRequest::RT_HTTP, $cmd, request::getAll());
         $res = new S2SResponse(S2SRequest::RT_HTTP, $cmd);
         $cmdp = explode('.', $cmd);
         $mod = $cmdp[0];
         $modc = $mod . 'S2SEndpoint';
         if (class_exists($modc)) {
             $ci = new $modc();
             $rd = $ci->invoke($req, $res);
             var_dump($rd);
         } else {
             printf("Bad endpoint");
         }
         return true;
     }
     return false;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:22,代码来源:requesthandler.php

示例12: using

<?php

config::def('lepton.gallery.mediadir', base::appPath() . '/media/');
config::def('lepton.gallery.cachedir', base::appPath() . '/cache/');
// config::def('lepton.gallery.renderer', array('WatermarkImageFilter','mylogo.png'));
using('lepton.graphics.canvas');
using('lepton.utils.pagination');
class GalleryItemsTable extends SqlTableSchema
{
    function define()
    {
        // Only to be used during testing!
        $this->dropOnCreate();
        // Table name
        $this->setName('galleryitems');
        // Table columns
        $this->addColumn('id', 'int', self::COL_AUTO | self::KEY_PRIMARY);
        $this->addColumn('name', 'varchar:160');
        $this->addColumn('uuid', 'char:37', self::COL_FIXED);
        $this->addColumn('src', 'varchar:200');
        // Indexes
        $this->addIndex('uuidkey', array('uuid'), self::KEY_UNIQUE);
        $this->addIndex('srckey', array('src'), self::KEY_UNIQUE);
    }
}
SqlTableSchema::apply(new GalleryItemsTable());
/**
 * @class Gallery
 * @package lepton.media
 * @brief Gallery Management
 *
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:gallery.php

示例13: using

<?php

using('lepton.system.threading');
interface ILdwpTransport
{
    function connect($uri);
    function getQueue();
    function getJob($jobid);
}
abstract class LdwpTransport implements ILdwpTransport
{
    static function factory($uri)
    {
        //
    }
    function connect($uri)
    {
    }
    function getQueue()
    {
    }
    function getJob($jobid)
    {
    }
}
class LdwpLocalTransport extends LdwpTransport
{
}
class LdwpHttpTransport extends LdwpTransport
{
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:31,代码来源:node.php

示例14: __construct

 function __construct($label,$key,array $options = null) {
     using('lepton.web.captcha');
     $this->setKey($key);
     $this->label = $label;
     parent::__construct($options);
     $this->captchaid = Captcha::generate();
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:7,代码来源:basic.php

示例15: __construct

 function __construct()
 {
     using('lepton.utils.streams');
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:4,代码来源:streams.php


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