• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ucfirst函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ucfirst函数的典型用法代码示例。如果您正苦于以下问题:PHP ucfirst函数的具体用法?PHP ucfirst怎么用?PHP ucfirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: view

 /**
  * Display a page with this order of priority (based on the provided page name) :
  *  1. Does the page exist into local/pages/{lang}/ (this allows you to overwrite default pages)?
  *  2. Does the page exist into the views available in views/pages/ folder?
  * Pages are not public and we take into account the language of the connected user.
  * If the page name contains the keyword export, then we don't output the default template.
  * @param string $page Name of the view (and of the corresponding PHP file)
  * @author Benjamin BALET <[email protected]>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     // Capitalize the first letter
     //The page containing export in their name are returning another MIMETYPE
     if (strpos($page, 'export') === FALSE) {
         //Don't include header and menu
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     //Check if we have a user-defined view
     if (file_exists($pathLocal . $view)) {
         $this->load->customView($pathLocal, $view, $data);
     } else {
         //Load the page from the default location (CI views folder)
         if (!file_exists($pathCI . $view)) {
             redirect('notfound');
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
开发者ID:ishawge,项目名称:jorani,代码行数:38,代码来源:pages.php


示例2: factory

 /**
  * 工厂, 创建操作各种数据库的对象.
  *
  * @param string|null $db_type 数据库类型, 如果传递 null 或者不传递则默认为 local RThink_Config 的
  *            db_type
  * @param array $options 数据库配置参数
  * @return object 操作相应数据库的对象
  * @throws em_db_exception
  */
 public static function factory($options, $db_type)
 {
     $adapter_name = ucfirst($db_type) . 'Adapter';
     $class_name = 'RThink_Db_' . $adapter_name;
     class_exists($class_name, false) || (require 'RThink/Db/' . $adapter_name . '.php');
     return new $class_name($options);
 }
开发者ID:tomorrowdemo,项目名称:haojiaolexue,代码行数:16,代码来源:Db.php


示例3: ucfirst

 /**
  *   
  * Factory method to create Tag Handlers
  *
  * $type = namespace eg. <flexy:toJavascript loads Flexy.php
  * the default is this... (eg. Tag)
  * 
  * 
  * @param   string    Namespace handler for element.
  * @param   object   HTML_Template_Flexy_Compiler  
  * 
  *
  * @return    object    tag compiler
  * @access   public
  */
 function &factory($type, &$compiler)
 {
     if (!$type) {
         $type = 'Tag';
     }
     $class = 'HTML_Template_Flexy_Compiler_Flexy_' . $type;
     if (class_exists($class)) {
         $ret = new $class();
         $ret->compiler =& $compiler;
         return $ret;
     }
     $filename = 'HTML/Template/Flexy/Compiler/Flexy/' . ucfirst(strtolower($type)) . '.php';
     if (!HTML_Template_Flexy_Compiler_Flexy_Tag::fileExistsInPath($filename)) {
         $ret = HTML_Template_Flexy_Compiler_Flexy_Tag::factory('Tag', $compiler);
         return $ret;
     }
     // if we dont have a handler - just use the basic handler.
     if (!file_exists(dirname(__FILE__) . '/' . ucfirst(strtolower($type)) . '.php')) {
         $type = 'Tag';
     }
     include_once 'HTML/Template/Flexy/Compiler/Flexy/' . ucfirst(strtolower($type)) . '.php';
     $class = 'HTML_Template_Flexy_Compiler_Flexy_' . $type;
     if (!class_exists($class)) {
         $ret = false;
         return $ret;
     }
     $ret = HTML_Template_Flexy_Compiler_Flexy_Tag::factory($type, $compiler);
     return $ret;
 }
开发者ID:alexzita,项目名称:alex_blog,代码行数:44,代码来源:Tag.php


示例4: __get

 public function __get($name)
 {
     $method = 'get' . ucfirst($name);
     if (method_exists($this, $method)) {
         return $this->{$method}();
     }
 }
开发者ID:Antoine07,项目名称:AppFromScratch,代码行数:7,代码来源:Product.php


示例5: process

 /**
  * Processes this test, when one of its tokens is encountered.
  *
  * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
  * @param int                  $stackPtr  The position of the current token in the
  *                                        stack passed in $tokens.
  *
  * @return void
  */
 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
 {
     $tokens = $phpcsFile->getTokens();
     // Make sure this is the first PHP open tag so we don't process
     // the same file twice.
     $prevOpenTag = $phpcsFile->findPrevious(T_OPEN_TAG, $stackPtr - 1);
     if ($prevOpenTag !== false) {
         return;
     }
     $fileName = $phpcsFile->getFileName();
     $extension = substr($fileName, strrpos($fileName, '.'));
     $nextClass = $phpcsFile->findNext(array(T_CLASS, T_INTERFACE), $stackPtr);
     if ($extension === '.php') {
         if ($nextClass !== false) {
             $error = '%s found in ".php" file; use ".inc" extension instead';
             $data = array(ucfirst($tokens[$nextClass]['content']));
             $phpcsFile->addError($error, $stackPtr, 'ClassFound', $data);
         }
     } else {
         if ($extension === '.inc') {
             if ($nextClass === false) {
                 $error = 'No interface or class found in ".inc" file; use ".php" extension instead';
                 $phpcsFile->addError($error, $stackPtr, 'NoClass');
             }
         }
     }
 }
开发者ID:CobaltBlueDW,项目名称:oddsandends,代码行数:36,代码来源:FileExtensionSniff.php


示例6: load

 public function load(TemplateReferenceInterface $template)
 {
     if (method_exists($this, $method = 'get' . ucfirst($template->get('name')) . 'Template')) {
         return new StringStorage($this->{$method}());
     }
     return false;
 }
开发者ID:symfony,项目名称:symfony,代码行数:7,代码来源:CacheLoaderTest.php


示例7: getFullClassName

 /**
  * getFullClassName()
  *
  * @param string $localClassName
  * @param string $classContextName
  */
 public function getFullClassName($localClassName, $classContextName = null)
 {
     // find the ApplicationDirectory OR ModuleDirectory
     $currentResource = $this->_resource;
     do {
         $resourceName = $currentResource->getName();
         if ($resourceName == 'ApplicationDirectory' || $resourceName == 'ModuleDirectory') {
             $containingResource = $currentResource;
             break;
         }
     } while ($currentResource instanceof Zend_Tool_Project_Profile_Resource && ($currentResource = $currentResource->getParentResource()));
     $fullClassName = '';
     // go find the proper prefix
     if (isset($containingResource)) {
         if ($containingResource->getName() == 'ApplicationDirectory') {
             $prefix = $containingResource->getAttribute('classNamePrefix');
             $fullClassName = $prefix;
         } elseif ($containingResource->getName() == 'ModuleDirectory') {
             $filter = new Zend_Filter_Word_DashToCamelCase();
             $prefix = $filter->filter(ucfirst($containingResource->getAttribute('moduleName'))) . '_';
             $fullClassName = $prefix;
         }
     }
     if ($classContextName) {
         $fullClassName .= rtrim($classContextName, '_') . '_';
     }
     $fullClassName .= $localClassName;
     return $fullClassName;
 }
开发者ID:conectapb,项目名称:sysagroweb,代码行数:35,代码来源:AbstractClassFile.php


示例8: generateClass

 /**
  * Generate Class
  *
  * @param string $className
  * @return string
  * @throws \Magento\Framework\Exception
  * @throws \InvalidArgumentException
  */
 public function generateClass($className)
 {
     // check if source class a generated entity
     $entity = null;
     $entityName = null;
     foreach ($this->_generatedEntities as $entityType => $generatorClass) {
         $entitySuffix = ucfirst($entityType);
         // if $className string ends on $entitySuffix substring
         if (strrpos($className, $entitySuffix) === strlen($className) - strlen($entitySuffix)) {
             $entity = $entityType;
             $entityName = rtrim(substr($className, 0, -1 * strlen($entitySuffix)), \Magento\Framework\Autoload\IncludePath::NS_SEPARATOR);
             break;
         }
     }
     if (!$entity || !$entityName) {
         return self::GENERATION_ERROR;
     }
     // check if file already exists
     $autoloader = $this->_autoloader;
     if ($autoloader::getFile($className)) {
         return self::GENERATION_SKIP;
     }
     if (!isset($this->_generatedEntities[$entity])) {
         throw new \InvalidArgumentException('Unknown generation entity.');
     }
     $generatorClass = $this->_generatedEntities[$entity];
     $generator = new $generatorClass($entityName, $className, $this->_ioObject);
     if (!$generator->generate()) {
         $errors = $generator->getErrors();
         throw new \Magento\Framework\Exception(implode(' ', $errors));
     }
     return self::GENERATION_SUCCESS;
 }
开发者ID:Mohitsahu123,项目名称:mtf,代码行数:41,代码来源:Generator.php


示例9: render

 /**
  * Interface with the Module Loader.
  *
  * @param string $key
  * @return string
  */
 public function render($key)
 {
     $getter = 'get' . ucfirst($key);
     /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
     $moduleLoader = $this->objectManager->get('Fab\\Vidi\\Module\\ModuleLoader');
     return $moduleLoader->{$getter}();
 }
开发者ID:BergischMedia,项目名称:vidi,代码行数:13,代码来源:ModuleLoaderViewHelper.php


示例10: getOptions

 /**
  * Method to get the list of database options.
  *
  * This method produces a drop down list of available databases supported
  * by JDatabaseDriver classes that are also supported by the application.
  *
  * @return  array  The field option objects.
  *
  * @since   11.3
  * @see     JDatabaseDriver::getConnectors()
  */
 protected function getOptions()
 {
     // This gets the connectors available in the platform and supported by the server.
     $available = JDatabaseDriver::getConnectors();
     /**
      * This gets the list of database types supported by the application.
      * This should be entered in the form definition as a comma separated list.
      * If no supported databases are listed, it is assumed all available databases
      * are supported.
      */
     $supported = $this->element['supported'];
     if (!empty($supported)) {
         $supported = explode(',', $supported);
         foreach ($supported as $support) {
             if (in_array($support, $available)) {
                 $options[$support] = JText::_(ucfirst($support));
             }
         }
     } else {
         foreach ($available as $support) {
             $options[$support] = JText::_(ucfirst($support));
         }
     }
     // This will come into play if an application is installed that requires
     // a database that is not available on the server.
     if (empty($options)) {
         $options[''] = JText::_('JNONE');
     }
     return $options;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:41,代码来源:databaseconnection.php


示例11: execute

 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|void
  * @throws \InvalidArgumentException
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $subCommandFactory = $this->createSubCommandFactory($input, $output, 'N98\\Magento\\Command\\Developer\\Module\\Create\\SubCommand');
     $configBag = $subCommandFactory->getConfig();
     if (!$input->getOption('modman')) {
         $this->detectMagento($output);
     }
     $configBag->setBool('isModmanMode', $input->getOption('modman'));
     $configBag->setString('magentoRootFolder', $this->_magentoRootFolder);
     $this->initConfigBagDefaultValues($configBag);
     if ($input->getOption('add-all')) {
         $configBag->setBool('shouldAddBlocks', true);
         $configBag->setBool('shouldAddHelpers', true);
         $configBag->setBool('shouldAddModels', true);
         $configBag->setBool('shouldAddSetup', true);
     }
     if ($input->getOption('add-blocks')) {
         $configBag->setBool('shouldAddBlocks', true);
     }
     if ($input->getOption('add-helpers')) {
         $configBag->setBool('shouldAddHelpers', true);
     }
     if ($input->getOption('add-models')) {
         $configBag->setBool('shouldAddModels', true);
     }
     if ($input->getOption('add-setup')) {
         $configBag->setBool('shouldAddSetup', true);
     }
     if ($input->getOption('enable')) {
         $configBag->setBool('shouldEnableModule', true);
     }
     $configBag->setString('baseFolder', __DIR__ . '/../../../../../../res/module/create');
     $configBag->setString('vendorNamespace', ucfirst($input->getArgument('vendorNamespace')));
     $configBag->setString('moduleName', ucfirst($input->getArgument('moduleName')));
     $this->initView($input, $configBag);
     $subCommandFactory->create('CreateModuleFolders')->execute();
     $subCommandFactory->create('CreateModuleRegistrationFiles')->execute();
     if (!$input->getOption('minimal')) {
         $subCommandFactory->create('CreateModuleConfigFile')->execute();
         $subCommandFactory->create('CreateModuleDiFile')->execute();
         $subCommandFactory->create('CreateModuleEventsFile')->execute();
         $subCommandFactory->create('CreateModuleCrontabFile')->execute();
     }
     $subCommandFactory->create('EnableModule')->execute();
     if ($input->getOption('add-readme')) {
         $subCommandFactory->create('CreateReadmeFile')->execute();
     }
     if ($input->getOption('modman')) {
         $subCommandFactory->create('CreateModmanFile')->execute();
     }
     if ($input->getOption('add-composer')) {
         $subCommandFactory->create('CreateComposerFile')->execute();
     }
     if ($input->getOption('add-setup')) {
         $subCommandFactory->create('CreateSetupFiles')->execute();
     }
     if (!$input->getOption('minimal')) {
         $subCommandFactory->create('CreateAdditionalFiles')->execute();
     }
 }
开发者ID:brentwpeterson,项目名称:n98-magerun2,代码行数:66,代码来源:CreateCommand.php


示例12: listItems

 /**
  * {@inheritdoc}
  */
 protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null)
 {
     // only list constants when no Reflector is present.
     //
     // TODO: make a NamespaceReflector and pass that in for commands like:
     //
     //     ls --constants Foo
     //
     // ... for listing constants in the Foo namespace
     if ($reflector !== null || $target !== null) {
         return;
     }
     // only list constants if we are specifically asked
     if (!$input->getOption('constants')) {
         return;
     }
     $category = $input->getOption('user') ? 'user' : $input->getOption('category');
     $label = $category ? ucfirst($category) . ' Constants' : 'Constants';
     $constants = $this->prepareConstants($this->getConstants($category));
     if (empty($constants)) {
         return;
     }
     $ret = array();
     $ret[$label] = $constants;
     return $ret;
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:29,代码来源:ConstantEnumerator.php


示例13: testAutomaticCasing

 /**
  * @param $test
  * @param $expected
  *
  * @dataProvider providerPlurals
  */
 public function testAutomaticCasing($test, $expected)
 {
     $test = ucfirst($test);
     $expected = ucfirst($expected);
     $pluralize = new Pluralize();
     $this->assertEquals($expected, $pluralize->fix($test));
 }
开发者ID:zomble,项目名称:pluralize,代码行数:13,代码来源:PluralizeTest.php


示例14: write

 /**
  * Writes given message to a log file in the logs directory.
  *
  * @param string $type Type of log, becomes part of the log's filename
  * @param string $msg  Message to log
  * @return boolean Success
  */
 function write($type, $msg)
 {
     $filename = LOGS . $type . '.log';
     $output = date('Y-m-d H:i:s') . ' ' . ucfirst($type) . ': ' . $msg . "\n";
     $log = new File($filename);
     return $log->append($output);
 }
开发者ID:carriercomm,项目名称:pastebin-5,代码行数:14,代码来源:cake_log.php


示例15: formatTokens

 public function formatTokens($content)
 {
     $upperCaseModelName = ucfirst($this->modelName);
     $field_name = snake_case($this->modelName) . '_name';
     $modelId = $this->formatInstanceVariable() . '->id';
     $modelAttribute = $this->formatInstanceVariable() . '->' . $field_name;
     $createdAt = $this->formatInstanceVariable() . '->created_at';
     $modelRoute = '/' . $this->folderName;
     $dtTableName = snake_case($this->modelName) . '_table';
     $masterPage = $this->masterPage;
     $modelName = $this->modelName;
     $modelsUpperCase = ucwords(str_plural($this->modelName));
     $folderName = $this->folderName;
     $gridName = $this->formatVueGridName() . '-grid';
     $endGridName = '/' . $this->formatVueGridName() . '-grid';
     $vueApiRoute = 'api/' . $this->folderName . '-vue';
     $parent = $this->parent;
     $parentInstance = $this->formatParentInstanceVariable($this->parent);
     $parentInstances = $this->formatParents($this->parent);
     $parent_id = strtolower(snake_case($this->parent)) . '_id';
     $parentFieldName = strtolower(snake_case($this->parent)) . '_name';
     $child = $this->child;
     $slug = $this->slug;
     //create token array using compact
     $tokens = compact('upperCaseModelName', 'field_name', 'modelId', 'modelAttribute', 'createdAt', 'modelRoute', 'dtTableName', 'masterPage', 'modelName', 'modelsUpperCase', 'folderName', 'gridName', 'endGridName', 'vueApiRoute', 'parent', 'parentInstance', 'parentInstances', 'parent_id', 'parentFieldName', 'child', 'slug');
     $content = $this->insertTokensInContent($content, $tokens);
     return $content;
 }
开发者ID:evercode1,项目名称:view-maker,代码行数:28,代码来源:FormatsTokens.php


示例16: getComponentRouter

 /**
  * Tries to create a new router object for given component, returns NULL
  * if object not supported
  * 
  * @staticvar JComponentRouterInterface[] $cache
  * @param string $component Component name in format "com_xxx"
  * @return \JComponentRouterInterface
  */
 protected static function getComponentRouter($component)
 {
     static $cache = array();
     if (!array_key_exists($component, $cache)) {
         $router = null;
         $compName = ucfirst(substr($component, 4));
         $class = $compName . 'Router';
         if (class_exists($class)) {
             // Check if it supports the Joomla router interface, because
             // some components use classes with the same name causing
             // fatal error then (eg. EasyBlog)
             $reflection = new ReflectionClass($class);
             if (in_array('JComponentRouterInterface', $reflection->getInterfaceNames())) {
                 // Create the router object
                 $app = JFactory::getApplication();
                 $menu = $app->getMenu('site');
                 $router = new $class($app, $menu);
             }
         }
         // If router class not supported, create legacy router object (Joomla 3)
         if (!$router && class_exists('JComponentRouterLegacy')) {
             $router = new JComponentRouterLegacy($compName);
         }
         // Cache the router object
         $cache[$component] = $router;
     }
     return $cache[$component];
 }
开发者ID:01J,项目名称:bealtine,代码行数:36,代码来源:joomsef.php


示例17: getLabel

 /**
  * {@inheritDoc}
  */
 public function getLabel($label, $context = '', $type = '')
 {
     if ($context == 'breadcrumb') {
         return sprintf('%s.%s_%s', $context, $type, strtolower($label));
     }
     return ucfirst(strtolower($label));
 }
开发者ID:natxet,项目名称:SonataAdminBundle,代码行数:10,代码来源:BCLabelTranslatorStrategy.php


示例18: factory

 /**
  * 工厂加载方法
  * 
  * @param string $section
  * @return object
  */
 public static function factory($section = 'sphinx')
 {
     static $instances = array();
     if ($section === 'all_instances') {
         return $instances;
     }
     $config = self::config($section);
     if (is_string($config)) {
         $section = $config;
         $config = self::config($section);
     }
     if (is_null($config)) {
         throw new InvalidArgumentException('search node [' . $section . '] not found', 101);
     }
     if (!isset($instances[$section]) || $instances[$section] === null) {
         if (isset($config['className'])) {
             $class = $config['className'];
         } else {
             $class = __CLASS__ . '_' . ucfirst($section);
         }
         $instances[$section] = new $class();
         if (isset($config['option'])) {
             return $instances[$section]->init($config['option']);
         }
     }
     return false;
 }
开发者ID:ahmatjan,项目名称:Scene-Editor-for-mobile,代码行数:33,代码来源:Searcher.php


示例19: configure

 /**
  * Command configure method
  */
 protected function configure()
 {
     $this->setName('wurst:print')->addArgument('type', null, sprintf('Which type of würst you want (%s)?', implode(', ', $this->wurstTypes)), 'classic')->setHelp('Please ask your local curry würst retailer.');
     foreach ($this->sides as $side) {
         $this->addOption('mit-' . $side, null, InputOption::VALUE_NONE, sprintf('Mit %s?', ucfirst($side)));
     }
 }
开发者ID:ekkinox,项目名称:MarcWWurstBundle,代码行数:10,代码来源:WurstCommand.php


示例20: loadController

 function loadController()
 {
     $controller = ucfirst($this->request->controller) . 'Controller';
     if ($this->request->prefix == COCKPIT) {
         if (!file_exists(ROOT . DS . CONTROLLER . DS . BACKEND . DS . $controller . '.php')) {
             if (!file_exists(ROOT . DS . CONTROLLER . DS . BACKEND . DS . 'extends' . DS . $controller . '.php')) {
                 $this->error();
             } else {
                 $file = ROOT . DS . CONTROLLER . DS . BACKEND . DS . 'extends' . DS . $controller . '.php';
             }
         } else {
             $file = ROOT . DS . CONTROLLER . DS . BACKEND . DS . $controller . '.php';
         }
     } else {
         if (!file_exists(ROOT . DS . CONTROLLER . DS . FRONTEND . DS . $controller . '.php')) {
             if (!file_exists(ROOT . DS . CONTROLLER . DS . FRONTEND . DS . 'extends' . DS . $controller . '.php')) {
                 $this->error();
             } else {
                 $file = ROOT . DS . CONTROLLER . DS . FRONTEND . DS . 'extends' . DS . $controller . '.php';
             }
         } else {
             $file = ROOT . DS . CONTROLLER . DS . FRONTEND . DS . $controller . '.php';
         }
     }
     require $file;
     return new $controller($this->request);
 }
开发者ID:WebPassions,项目名称:2015,代码行数:27,代码来源:Dispatcher.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP uctrans函数代码示例发布时间:2022-05-23
下一篇:
PHP ucf函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap