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


PHP Loader::setExtensions方法代码示例

本文整理汇总了PHP中Phalcon\Loader::setExtensions方法的典型用法代码示例。如果您正苦于以下问题:PHP Loader::setExtensions方法的具体用法?PHP Loader::setExtensions怎么用?PHP Loader::setExtensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phalcon\Loader的用法示例。


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

示例1: function

<?php

use Phalcon\Loader, Phalcon\Mvc\Model, Phalcon\Mvc\Url, Phalcon\Crypt, Phalcon\Mvc\View\Engine\Volt, Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter, Phalcon\Logger\Multiple as MultipleStreamLogger, Phalcon\Logger\Adapter\File as FileLogger, Phalcon\Logger\Adapter\Firephp as FirephpLogger, Webird\Module, Webird\Mvc\View\Simple as ViewSimple, Webird\Acl\Acl, Webird\DatabaseSessionReader, Webird\Locale\Locale, Webird\Locale\Gettext, Webird\Mailer\Manager as MailManager, Webird\Logger\Adapter\Error as ErrorLogger, Webird\Logger\Adapter\Firelogger;
/**
 *
 */
Model::setup(['phqlLiterals' => false, 'notNullValidations' => false]);
/**
 *
 */
$di->set('loader', function () use($config) {
    $commonDir = $config->path->commonDir;
    $modulesDir = $config->path->modulesDir;
    $loader = new Loader();
    $loader->setExtensions(['php']);
    $loader->registerNamespaces(['Webird\\Models' => "{$commonDir}/models", 'Webird\\Forms' => "{$commonDir}/forms", 'Webird\\Plugins' => "{$commonDir}/plugins", 'Webird' => "{$commonDir}/library"]);
    $loader->register();
    $classes = [];
    foreach ($config->app->modules as $moduleName) {
        $class = 'Webird\\' . ucfirst($moduleName) . '\\Module';
        $path = Module::moduleNameToDir($moduleName) . 'Module.php';
        $classes[$class] = $path;
    }
    $loader->registerClasses($classes, true);
    $loader->register();
    return $loader;
});
$di->get('loader');
/**
 *
 */
开发者ID:JanOschii,项目名称:webird,代码行数:31,代码来源:services.php

示例2: Loader

<?php

use Phalcon\Loader;
use Phalcon\Mvc\Micro;
use Phalcon\Mvc\Micro\Collection as MicroCollection;
use Phalcon\Di\FactoryDefault;
use Phalcon\Db\Adapter\Pdo\Mysql as PdoMysql;
// Use Loader() to autoload our model
$loader = new Loader();
$loader->registerDirs(array('models', 'controllers'))->register();
$loader->setExtensions(array("php", "inc", "phb"));
$di = new FactoryDefault();
// Set up the database service
$di->set('db', function () {
    return new PdoMysql(array("host" => "localhost", "username" => "root", "password" => "", "dbname" => "oversign"));
});
$app = new Micro($di);
$users = new MicroCollection();
$users->setHandler("UserController", true);
$users->setPrefix('/user');
$users->get('/', 'hello');
$app->mount($users);
// Retrieves all robots
$app->get('/api/robots', function () {
    $phql = "SELECT * FROM Robots ORDER BY name";
    $robots = $app->modelsManager->executeQuery($phql);
    $data = array();
    foreach ($robots as $robot) {
        $data[] = array('id' => $robot->id, 'name' => $robot->name);
    }
    echo json_encode($data);
开发者ID:silvranz,项目名称:api,代码行数:31,代码来源:index.php

示例3: Loader

<?php

use Phalcon\Loader;
use Phalcon\Mvc\Micro;
use Phalcon\Di\FactoryDefault;
use Phalcon\Db\Adapter\Pdo\Mysql as PdoMysql;
use Phalcon\Http\Response;
// use Loader() to autoload our model
$loader = new Loader();
$loader->setExtensions(array("php"));
$loader->registerDirs(array(__DIR__ . '/models/'))->register();
// set up the database service
$di = new FactoryDefault();
//----------------------------
//DATABASE CONFIG
//----------------------------
$di->set('db', function () {
    return new PdoMysql(array("host" => "localhost", "port" => "", "username" => "root", "password" => "faraz", "dbname" => "products"));
});
//table name in schema is Products, if change is made to this table name then
//API method handlers should be updated
// bind the DI to the application
$app = new Micro($di);
// API -------------------------------------------
// Products is the table name in MySQL database
// Retrieves all products
$app->get('/api/products', function () use($app) {
    $phql = "SELECT * FROM Products ORDER BY name";
    //Products is table name
    $products = $app->modelsManager->executeQuery($phql);
    $data = array();
开发者ID:faahmad,项目名称:krossover-rest-api,代码行数:31,代码来源:index.php

示例4: setExtensions

 public function setExtensions(array $extensions)
 {
     return parent::setExtensions($extensions);
 }
开发者ID:mattvb91,项目名称:cphalcon,代码行数:4,代码来源:Loader.php


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