本文整理汇总了PHP中strToUpper函数的典型用法代码示例。如果您正苦于以下问题:PHP strToUpper函数的具体用法?PHP strToUpper怎么用?PHP strToUpper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strToUpper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Start
function Start()
{
//no cache for post
if (strToUpper($_SERVER['REQUEST_METHOD']) == 'POST') {
return;
}
//no cache for sessions
if (count($_SESSION)) {
return;
} else {
@session_destroy();
}
//construct cache name
$this->name = $this->prefix . rawUrlEncode($_SERVER['SCRIPT_FILENAME']) . rawUrlEncode($_SERVER['QUERY_STRING']) . '.hTm';
//check for cache
if (!file_exists($this->dir . '/' . $this->name)) {
ob_start();
} else {
$STAT = @stat($this->dir . '/' . $this->name);
if ($STAT[9] + $this->expire > time() && $STAT[7] > 0) {
echo "<!--start of cached version (", date('D, M-d-Y H:i:s', $STAT[9]), ")-->\n";
readfile($this->dir . '/' . $this->name);
die("\n<!--end of cached version-->");
} else {
$this->force = $this->dir . '/' . $this->name;
echo "<!--detected expired cached version (" . date('D, M-d-Y H:i:s', $STAT[9]) . ")-->\n";
}
}
}
示例2: addSimpleField
/**
* add a new field definition (this function will replace "addField")
* @since Version 1.1.0
*
* @param string $label
* @param string $field_name
* @param string $field_type
* @param mixed $width
* @param array $extraData
* @return array with field definition
*/
public function addSimpleField($label, $field_name, $field_type, $width = null, array $extraData = array())
{
$data = array();
$data['label'] = $label;
$data['field'] = $field_name;
$data['type'] = strToUpper($field_type);
$data['width'] = $width;
if (isset($extraData['align'])) {
$data['align'] = $extraData['align'];
} else {
$data['align'] = $this->getDefaultAlign($field_type);
}
if (isset($extraData['sortable'])) {
$data['sortable'] = $extraData['sortable'];
} else {
$data['sortable'] = false;
}
if (isset($extraData['order_fields'])) {
$data['order_fields'] = $extraData['order_fields'];
} else {
$data['order_fields'] = $field_name;
}
if (isset($extraData['format'])) {
$data['format'] = $extraData['format'];
} else {
$data['format'] = false;
}
if (isset($extraData['number_format'])) {
$data['number_format'] = $extraData['number_format'];
} else {
$data['number_format'] = false;
}
$this->fields[] = $data;
return $data;
}
示例3: factory
/**
* Factory
*
* @param string $format MO or PO
* @param string $file path to GNU gettext file
*
* @static
* @access public
* @return object Returns File_Gettext_PO or File_Gettext_MO on success
* or PEAR_Error on failure.
*/
function factory($format, $file = '')
{
$format = strToUpper($format);
$class = 'File_Gettext_' . $format;
$obref = new $class($file);
return $obref;
}
示例4: toCamelCase
/**
* Converts a dash separated string into a camel case string.
* @param string $str Dash separated string.
* @return string Camel cased string.
*/
function toCamelCase($str)
{
while (($index = strpos($str, '-')) !== false) {
$str = substr($str, 0, $index) . strToUpper(substr($str, $index + 1, 1)) . substr($str, $index + 2);
}
return $str;
}
示例5: download
/**
* Shortcut method for fetching an URL
* @param string $url
* @return string the fetched HTML
*/
protected function download($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
curl_setopt($ch, CURLOPT_URL, $url);
$u = parse_url($url);
$cookie_txt = '/tmp/' . strToUpper($u['host']) . '.txt';
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_txt);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_txt);
curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_VERBOSE, 1);
//curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
if (false === $response) {
throw new Exception(curl_error($ch) . ' (' . curl_errno($ch) . ')');
}
if (200 != ($code = curl_getinfo($ch, CURLINFO_HTTP_CODE))) {
throw new Exception("Response code is not 200, but {$code}; " . curl_getinfo($ch, CURLINFO_HEADER_OUT));
}
curl_close($ch);
return $response;
}
示例6: _collect
/**
* Obtain the request variables for the desired type
* @name _collect
* @type method
* @access protected
* @return void
*/
protected function _collect()
{
// determine the collection and try to populate it's properties
switch ($this->_type) {
// use PHP's built-in _GET and/or _POST superglobals, override after copying
case 'get':
case 'post':
$super = '_' . strToUpper($this->_type);
if (isset($GLOBALS[$super]) && is_array($GLOBALS[$super])) {
$buffer = $this->_type === 'get' ? $this->call('/Tool/serverVal', 'QUERY_STRING') : trim(file_get_contents('php://input'));
$this->_populate($GLOBALS[$super], $buffer);
}
$GLOBALS[$super] = $this;
break;
// provide PUT and DELETE support
// provide PUT and DELETE support
case 'put':
case 'delete':
$super = '_' . strToUpper($this->_type);
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == strToUpper($this->_type)) {
$raw = trim(file_get_contents("php://input"));
if (!empty($raw)) {
parse_str($raw, $temp);
$this->_populate($temp, $raw);
}
}
$GLOBALS[$super] = $this;
break;
default:
$this->call('/Log/message', 'Unsupported request type: ' . $this->_type, 1);
break;
}
}
示例7: __construct
function __construct($namespace = "zmax")
{
$this->_namespace = $namespace;
$this->_nsLength = strlen($namespace);
// Keep also the Uppercase version (SAX gives everything in uppercase)
$this->_nsUpper = strToUpper($namespace);
}
示例8: decode
public static function decode($source)
{
$num = sizeof(self::$bArr);
$len = strlen($source);
$out = 0;
if (3 > $len) {
throw new \Exception("Given code ({$source}} is too short; at least 3 letters expected.");
}
if (1 != $len % 2) {
throw new \Exception("Wrong code ({$source}} given.");
}
if ($len != $num * 2 - 1) {
throw new \Exception("Given code ({$source}} doesn't match given number size.");
}
$tmp = array();
for ($i = 0; $i < $len; $i += 2) {
array_unshift($tmp, strToLower($source[$i]));
}
$exp = 1;
foreach ($tmp as $i => $v) {
$p = strpos(self::$bArr[$i], $v);
if (false === $p) {
$v = strToUpper($v);
throw new \Exception("Index \"{$v}\" not found in ({$source}), at least 2 required.");
}
$out += $p * $exp;
$exp = $exp * 20;
}
$p = strpos(self::$aArr, strToLower($source[1]));
if ($p != $out % 5) {
throw new \Exception("Control number in ({$source}) doesn't match.");
}
return $out;
}
示例9: colesoStrToUpper
function colesoStrToUpper($str)
{
$localeData = colesoApplication::getConfigVal('/system/localeData');
if (isset($localeData['isMultiByte'])) {
return mb_strtoupper($str, $localeData['encoding']);
}
return strToUpper($str);
}
示例10: checkPerm
public function checkPerm()
{
$act = 'SET';
$name = strToUpper($this->baseName);
if (!$this->auth->hasPerm($act, $name)) {
die(sprintf(_("PERMISSION DENIED [%s/%s]"), $act, $name));
}
}
示例11: strToHex
public static function strToHex($string, $addEmptyByte = false)
{
$hex = '';
for ($i = 0; $i < strlen($string); $i++) {
$hex .= ($addEmptyByte ? "00" : "") . substr('0' . dechex(ord($string[$i])), -2);
}
return strToUpper($hex);
}
示例12: strToHex
public static function strToHex($string)
{
$hex = '';
for ($i = 0; $i < strlen($string); $i++) {
$hex .= substr('0' . dechex(ord($string[$i])), -2);
}
return strToUpper($hex);
}
示例13: lang
/**
* @return string
* @param srting $id
*/
public function lang($id = null)
{
if (null !== $id) {
$this->lang = strToUpper($id);
$this->plural = null;
}
return $this->lang;
}
示例14: toSql
/**
* @return string
* @param $type
*/
public function toSql($type = null)
{
if (null === $type) {
$type = Nano::db()->getType();
}
$format = 'Date::FORMAT_' . strToUpper($type);
return $this->format(constant($format));
}
示例15: send
/**
* Send a bunch of files or directories as an archive
*
* Example:
* <code>
* require_once 'HTTP/Download/Archive.php';
* HTTP_Download_Archive::send(
* 'myArchive.tgz',
* '/var/ftp/pub/mike',
* HTTP_DOWNLOAD_BZ2,
* '',
* '/var/ftp/pub'
* );
* </code>
*
* @see Archive_Tar::createModify()
* @static
* @access public
* @return mixed Returns true on success or PEAR_Error on failure.
* @param string $name name the sent archive should have
* @param mixed $files files/directories
* @param string $type archive type
* @param string $add_path path that should be prepended to the files
* @param string $strip_path path that should be stripped from the files
*/
function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_path = '')
{
$tmp = System::mktemp();
switch ($type = strToUpper($type))
{
case HTTP_DOWNLOAD_TAR:
include_once 'Archive/Tar.php';
$arc = &new Archive_Tar($tmp);
$content_type = 'x-tar';
break;
case HTTP_DOWNLOAD_TGZ:
include_once 'Archive/Tar.php';
$arc = &new Archive_Tar($tmp, 'gz');
$content_type = 'x-gzip';
break;
case HTTP_DOWNLOAD_BZ2:
include_once 'Archive/Tar.php';
$arc = &new Archive_Tar($tmp, 'bz2');
$content_type = 'x-bzip2';
break;
case HTTP_DOWNLOAD_ZIP:
include_once 'Archive/Zip.php';
$arc = &new Archive_Zip($tmp);
$content_type = 'x-zip';
break;
default:
return PEAR::raiseError(
'Archive type not supported: ' . $type,
HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE
);
}
if ($type == HTTP_DOWNLOAD_ZIP) {
$options = array( 'add_path' => $add_path,
'remove_path' => $strip_path);
if (!$arc->create($files, $options)) {
return PEAR::raiseError('Archive creation failed.');
}
} else {
if (!$e = $arc->createModify($files, $add_path, $strip_path)) {
return PEAR::raiseError('Archive creation failed.');
}
if (PEAR::isError($e)) {
return $e;
}
}
unset($arc);
$dl = &new HTTP_Download(array('file' => $tmp));
$dl->setContentType('application/' . $content_type);
$dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);
return $dl->send();
}