当前位置: 首页>>代码示例>>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;未经允许,请勿转载。