當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Container::factory方法代碼示例

本文整理匯總了PHP中Container::factory方法的典型用法代碼示例。如果您正苦於以下問題:PHP Container::factory方法的具體用法?PHP Container::factory怎麽用?PHP Container::factory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Container的用法示例。


在下文中一共展示了Container::factory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testFactoryExists

 public function testFactoryExists()
 {
     $this->assertFalse($this->container->factoryExists('foo'));
     $this->container->factory('foo', function () {
     });
     $this->assertTrue($this->container->factoryExists('foo'));
 }
開發者ID:nick-jones,項目名稱:simpleconfig,代碼行數:7,代碼來源:ContainerTest.php

示例2: testFactory

 public function testFactory()
 {
     $c = new Container();
     $c->factory('service', function () {
         return mt_rand() + mt_rand() + mt_rand();
     });
     $this->assertNotEquals($c->get('service'), $c->get('service'));
 }
開發者ID:nicklasos,項目名稱:BoringDI,代碼行數:8,代碼來源:ContainerTest.php

示例3: before

  public function before() {
    $session = Container::factory('Session', null, array('name' => 'main'));
    $session->set_timeout(5);

    $this->template_data['global']['assets']['js'][] = 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js';
    $this->template_data['global']['assets']['js'][] = 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js';
    $this->template_data['global']['assets']['js'][] = '/js/loopedslider.js';

    return parent::before();
  }
開發者ID:nathacof,項目名稱:mineserver-website,代碼行數:10,代碼來源:default.php

示例4: action_archive

 public function action_archive() {
   $this->template_data['global']['title']['description'] = 'Archives';
   $this->template_data['posts'] = Container::factory('doctrine')->createQuery("SELECT p FROM Model_News_Post p ORDER BY p.time DESC")->setMaxResults(10)->getArrayResult();
 }
開發者ID:nathacof,項目名稱:mineserver-website,代碼行數:4,代碼來源:news.php

示例5: action_newsposts

 public function action_newsposts() {
   $this->template_data['posts'] = Container::factory('doctrine')->createQuery("SELECT p.name AS post_name, p.id AS post_id, pu.name AS user_name, pu.id AS user_id FROM Model_News_Post p LEFT JOIN p.user pu ORDER BY p.time DESC")->setMaxResults(10)->getArrayResult();
 }
開發者ID:nathacof,項目名稱:mineserver-website,代碼行數:3,代碼來源:sidebar.php


注:本文中的Container::factory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。