本文整理汇总了PHP中Phalcon\Text::lower方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::lower方法的具体用法?PHP Text::lower怎么用?PHP Text::lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Text
的用法示例。
在下文中一共展示了Text::lower方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolve
/**
* {@inheritdoc}
*/
public function resolve(&$value)
{
if (is_string($value) && strlen($value) > 0) {
$value = \Phalcon\Text::lower($value);
}
return $value;
}
示例2: cast
/**
* Cast value to string
* @param $value
* @return string
*/
public function cast($value)
{
if ($this->_trim === null && self::$_defaultTrim !== null) {
$this->_trim = self::$_defaultTrim;
}
if (is_scalar($value)) {
$value = (string) $value;
if ($this->_trim === true) {
$value = trim($value);
}
if ($this->_uppercase === true) {
$value = \Phalcon\Text::upper($value);
} elseif ($this->_lowercase === true) {
$value = \Phalcon\Text::lower($value);
}
return $value;
}
return '';
}
示例3: register
/**
* Initializes dispatcher
*/
public function register()
{
$di = $this->getDi();
$eventsManager = $this->getEventsManager();
$config = $this->_config;
$defaultModuleDir = $this->_module->getDefaultModuleDirectory();
$di->set('defualtModuleDir', function () use($defaultModuleDir) {
return $defaultModuleDir;
});
$moduleDirectory = $this->_module->getModuleDirectory();
$di->set('moduleDirectory', function () use($moduleDirectory) {
return $moduleDirectory;
});
$di->set('dispatcher', function () use($di, $eventsManager, $config) {
// Create dispatcher
$dispatcher = new MvcDispatcher();
//Attach a listener
$eventsManager->attach("dispatch:beforeException", function ($event, \Phalcon\Mvc\Dispatcher $dispatcher, $exception) use($di, $config) {
if ($config->application->debug && $di->has('logger')) {
$logger = $di->get('logger');
$logger->error($exception->getMessage());
}
//Handle 404 exceptions
if ($exception instanceof DispatchException) {
$dispatcher->forward(['controller' => 'error', 'action' => 'show404']);
return false;
}
if ($di->get('request')->isAjax() == true) {
}
//Handle other exceptions
$dispatcher->forward(['controller' => 'error', 'action' => 'show503']);
return false;
});
$eventsManager->attach("dispatch:beforeDispatchLoop", function ($event, \Phalcon\Mvc\Dispatcher $dispatcher) {
$dispatcher->setControllerName(\Phalcon\Text::lower($dispatcher->getControllerName()));
});
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
}
示例4: function
$url->setBaseUri("http://" . $_SERVER["SERVER_NAME"] . "/");
return $url;
});
$di->set('router', function () {
$router = new \Phalcon\Mvc\Router();
$router->setDefaultModule("frontend");
$router->add("/", array('module' => 'frontend', 'controller' => 'index', 'action' => 'index'));
$router->add("/contactanos", array('module' => 'frontend', 'controller' => 'index', 'action' => 'contactanos'));
$router->add("/token", array('module' => 'frontend', 'controller' => 'index', 'action' => 'token'));
$router->notFound(array('module' => 'frontend', 'controller' => 'index', 'action' => 'show404'));
/* Dashboard */
$router->add("/dashboard", array('module' => 'dashboard', 'controller' => 'index', 'action' => 'index'));
$router->add("/login", array('module' => 'dashboard', 'controller' => 'login', 'action' => 'index'));
$router->add("/logout", array('module' => 'dashboard', 'controller' => 'login', 'action' => 'logout'));
$router->add('/dashboard/([a-zA-Z\\-]+)/([a-zA-Z\\-]+)', array('module' => 'dashboard', 'controller' => 1, 'action' => 2))->setName("controllers")->convert('action', function ($action) {
return \Phalcon\Text::lower(\Phalcon\Text::camelize($action));
});
$router->removeExtraSlashes(true);
return $router;
});
/**
* Start the session the first time some component request the session service
*/
$di->set('dispatcher', function () use($di) {
$dispatcher = new \Phalcon\Mvc\Dispatcher();
$eventsManager = $di->getShared('eventsManager');
$security = new Security($di);
$eventsManager->attach('dispatch', $security);
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
示例5: lower
public static function lower($str)
{
return parent::lower($str);
}
示例6: lower
public static function lower($str, $encoding = "UTF-8")
{
return parent::lower($str, $encoding);
}
示例7: testLower
public function testLower()
{
$this->assertEquals(PhText::lower('hello'), 'hello');
$this->assertEquals(PhText::lower('HELLO'), 'hello');
$this->assertEquals(PhText::lower('1234'), '1234');
}
示例8: testLowerException
public function testLowerException()
{
$this->setExpectedException('\\Phalcon\\Exception');
\Phalcon\Text::lower(13.43);
}