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


PHP Loader::import方法代碼示例

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


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

示例1: __construct

 /**
  * 架構函數
  * @access public
  */
 public function __construct()
 {
     //控製器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //導入類庫
     \think\Loader::import('vendor.Hprose.HproseHttpServer');
     //實例化HproseHttpServer
     $server = new \HproseHttpServer();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
         $methods = array_diff($methods, array('__construct', '__call', '_initialize'));
     }
     $server->addMethods($methods, $this);
     if (APP_DEBUG || $this->debug) {
         $server->setDebugEnabled(true);
     }
     // Hprose設置
     $server->setCrossDomainEnabled($this->crossDomain);
     $server->setP3PEnabled($this->P3P);
     $server->setGetEnabled($this->get);
     // 啟動server
     $server->start();
 }
開發者ID:Lofanmi,項目名稱:think,代碼行數:31,代碼來源:Hprose.php

示例2: __construct

 /**
  * 架構函數
  * @access public
  */
 public function __construct()
 {
     //控製器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //導入類庫
     \think\Loader::import('vendor.jsonrpc.jsonRPCServer');
     // 啟動server
     \jsonRPCServer::handle($this);
 }
開發者ID:Lofanmi,項目名稱:think,代碼行數:15,代碼來源:Jsonrpc.php

示例3: __construct

 /**
  * 架構函數
  * @access public
  */
 public function __construct()
 {
     //控製器初始化
     if (method_exists($this, '_initialize')) {
         $this->_initialize();
     }
     //導入類庫
     \think\Loader::import('vendor.phprpc.phprpc_server');
     //實例化phprpc
     $server = new \PHPRPC_Server();
     if ($this->allowMethodList) {
         $methods = $this->allowMethodList;
     } else {
         $methods = get_class_methods($this);
         $methods = array_diff($methods, array('__construct', '__call', '_initialize'));
     }
     $server->add($methods, $this);
     if (APP_DEBUG || $this->debug) {
         $server->setDebugMode(true);
     }
     $server->setEnableGZIP(true);
     $server->start();
     echo $server->comment();
 }
開發者ID:Lofanmi,項目名稱:think,代碼行數:28,代碼來源:Rpc.php

示例4: T

/**
 * 快速導入Traits
 * @param string $class trait庫
 * @param string $ext 類庫後綴
 * @return boolean
 */
function T($class, $ext = EXT)
{
    return \think\Loader::import($class, TRAIT_PATH, $ext);
}
開發者ID:yuhongjie,項目名稱:think,代碼行數:10,代碼來源:helper.php

示例5: vendor

 /**
  * 快速導入第三方框架類庫 所有第三方框架的類庫文件統一放到 係統的Vendor目錄下麵
  * @param string    $class 類庫
  * @param string    $ext 類庫後綴
  * @return boolean
  */
 function vendor($class, $ext = EXT)
 {
     return Loader::import($class, VENDOR_PATH, $ext);
 }
開發者ID:pangPython,項目名稱:iNewsCMS,代碼行數:10,代碼來源:helper.php

示例6:

<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\model;

use think\Lang;
use think\Loader;
\think\Loader::import('modle/Adv', TRAIT_PATH, EXT);
/**
 * MongoModel模型類
 * 實現了ODM和ActiveRecords模式
 */
class Mongo extends \think\Model
{
    use \traits\model\Adv;
    // 主鍵類型
    const TYPE_OBJECT = 1;
    const TYPE_INT = 2;
    const TYPE_STRING = 3;
    // 主鍵名稱
    protected $pk = '_id';
    // _id 類型 1 Object 采用MongoId對象 2 Int 整形 支持自動增長 3 String 字符串Hash
    protected $_idType = self::TYPE_OBJECT;
開發者ID:cnzin,項目名稱:think,代碼行數:31,代碼來源:Mongo.php

示例7:

<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think;

\think\Loader::import('controller/Jump', TRAIT_PATH, EXT);
use think\Exception;
use think\exception\ValidateException;
class Controller
{
    use \traits\controller\Jump;
    // 視圖類實例
    protected $view;
    // Request實例
    protected $request;
    // 驗證失敗是否拋出異常
    protected $failException = false;
    // 是否批量驗證
    protected $batchValidate = false;
    /**
     * 前置操作方法列表
     * @var array $beforeActionList
     * @access protected
開發者ID:top-think,項目名稱:framework,代碼行數:31,代碼來源:Controller.php

示例8:

<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\model;

\think\Loader::import('model/View', TRAIT_PATH, EXT);
class View extends \think\Model
{
    use \traits\model\View;
}
開發者ID:cnzin,項目名稱:think,代碼行數:18,代碼來源:View.php

示例9: testImport

 public function testImport()
 {
     $this->assertEquals(true, Loader::import('think.log.driver.Sae'));
     $this->assertEquals(false, Loader::import('think.log.driver.MyTest'));
 }
開發者ID:cnzin,項目名稱:think,代碼行數:5,代碼來源:loaderTest.php

示例10:

<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\model;

\think\Loader::import('model/Adv', TRAIT_PATH, EXT);
\think\Loader::import('model/Transaction', TRAIT_PATH, EXT);
class Adv extends \think\Model
{
    use \traits\model\Adv;
    use \traits\model\Transaction;
}
開發者ID:cnzin,項目名稱:think,代碼行數:20,代碼來源:Adv.php

示例11:

<?php

// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\model;

\think\Loader::import('model/Relation', TRAIT_PATH, EXT);
class Relation extends \think\Model
{
    use \traits\model\Relation;
}
開發者ID:cnzin,項目名稱:think,代碼行數:18,代碼來源:Relation.php


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