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


PHP Variable::factory方法代码示例

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


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

示例1: __construct

 /**
  * Construction of object initializes a connection resource to the link
  * variable
  * @param string $dsn
  */
 public function __construct($database_type, $username, $password = null, $database_name = null, $host = null, $port = null)
 {
     $this->database_type = \Variable::factory('string', $database_type, 'database_type');
     $this->database_type->setLimit(12);
     $this->database_type->setLabel(t('Database type'));
     $this->database_type->wordCharactersOnly();
     $this->database_name = \Variable::factory('string', $database_name, 'database_name');
     $this->database_name->setLimit(58);
     $this->database_name->setLabel(t('Database name'));
     $this->database_name->wordCharactersOnly();
     $this->username = \Variable::factory('string', $username, 'username');
     $this->username->setLimit(255);
     $this->username->setLabel(t('Database user name'));
     $this->username->wordCharactersOnly();
     $this->password = \Variable::factory('string', $password, 'password');
     $this->password->setLimit(255);
     $this->password->setLabel(t('Database password'));
     $this->password->setInputType('password');
     $this->table_prefix = \Variable::factory('string', null, 'table_prefix');
     $this->table_prefix->allowNull(true);
     $this->table_prefix->setLimit(5);
     $this->table_prefix->setLabel(t('Table prefix'));
     $this->table_prefix->wordCharactersOnly();
     $this->host = \Variable::factory('string', null, 'host');
     $this->host->setLimit(255);
     $this->host->setLabel('Database host');
     $this->host->allowNull(true);
     $this->host->set($host);
     $this->port = \Variable::factory('integer', null, 'port');
     $this->port->setLabel('Database port');
     $this->port->setRange('1', '65535');
     $this->port->allowNull(true);
     if (!empty($port)) {
         $this->port->set($port);
     }
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:41,代码来源:DSN.php

示例2: setName

 public function setName($name)
 {
     $this->name = \Variable::factory('alphanumeric', $name);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:4,代码来源:Datatype.php


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