當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。