本文整理汇总了PHP中Convert::toConstant方法的典型用法代码示例。如果您正苦于以下问题:PHP Convert::toConstant方法的具体用法?PHP Convert::toConstant怎么用?PHP Convert::toConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::toConstant方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: encrypt
public function encrypt($data = '', $settings = array())
{
$cipher = isset($settings['cipher']) ? $settings['cipher'] : 'sha256';
$key = isset($settings['key']) ? $settings['key'] : Config::get('Encode', 'projectKey');
// MHASH_ ön eki ilave ediliyor.
$cipher = Convert::toConstant($cipher, 'MHASH_');
return base64_encode(trim(mhash($cipher, $data, $key)));
}
示例2: dnsRecords
public function dnsRecords($host = '', $type = 'any', $raw = false)
{
if (!is_string($host)) {
return Error::set('Error', 'stringParameter', '1.(host)');
}
$dns = dns_get_record($this->cleanHttp($host), Convert::toConstant($type, 'DNS_'), $auth, $add, $raw);
return (object) array('records' => $dns, 'authns' => $auth, 'addtl' => $add);
}
示例3: decrypt
public function decrypt($data = '', $settings = array())
{
$cipher = isset($settings['cipher']) ? $settings['cipher'] : 'des';
$cipher = str_replace('-', '_', $cipher);
$key = isset($settings['key']) ? $settings['key'] : $this->keySize($cipher);
$mode = isset($settings['mode']) ? $settings['mode'] : 'cbc';
$iv = isset($settings['vector']) ? $settings['vector'] : $this->vectorSize($mode, $cipher);
// MCRYPT_ ön eki ilave ediliyor.
$cipher = Convert::toConstant($cipher, 'MCRYPT_');
// MCRYPT_MODE_ ön eki ilave ediliyor.
$mode = Convert::toConstant($mode, 'MCRYPT_MODE_');
$data = base64_decode($data);
return trim(mcrypt_decrypt($cipher, $key, trim($data), $mode, $iv));
}
示例4: locale
public function locale($category = '', $locale = '')
{
return setlocale(Convert::toConstant($category, 'LC_'), $locale);
}
示例5: translationTable
public function translationTable($table = HTML_SPECIALCHARS, $quote = ENT_COMPAT)
{
if (!is_scalar($table) || !is_scalar($quote)) {
return Error::set('Error', 'scalarParameter', '1.(table) & 2.(quote)');
}
return get_html_translation_table(Convert::toConstant($table, 'HTML_'), Convert::toConstant($quote, 'ENT_'));
}
示例6: deleteRecurrent
public function deleteRecurrent($array = array(), $flags = 'string')
{
if (!is_array($array)) {
return Error::set('Error', 'arrayParameter', '1.(array)');
}
return array_unique($array, Convert::toConstant($flags, 'SORT_'));
}
示例7: _filterConstant
protected function _filterConstant($const)
{
return Convert::toConstant($const, 'FILTER_');
}
示例8: casing
public function casing($string = '', $flag = 'upper', $encoding = 'UTF-8')
{
if (!is_string($string)) {
return Error::set('Error', 'stringParameter', '1.(string)');
}
if (!isCharset($encoding)) {
return Error::set('Error', 'charsetParameter', '3.($encoding)');
}
return mb_convert_case($string, Convert::toConstant($flag, 'MB_CASE_'), $encoding);
}
示例9: tokenFileInfo
public static function tokenFileInfo($fileName = '', $type = T_FUNCTION)
{
if (!is_file($fileName)) {
return false;
}
// Dosya içeriğini al ve tarama yap.
$tokens = token_get_all(file_get_contents($fileName));
$info = array();
$i = 0;
$type = Convert::toConstant($type, 'T_');
foreach ($tokens as $token) {
// -------------------------------------------------------------------------------------------
// Fonksiyon ismi yakalanıyor
// -------------------------------------------------------------------------------------------
if ($token[0] === $type) {
// Sınıf bilgisi oluşturuluyor...
$info[] = isset($tokens[$i + 2][1]) ? $tokens[$i + 2][1] : NULL;
}
// -------------------------------------------------------------------------------------------
$i++;
}
return $info;
}
示例10: option
public function option($options = 0, $value = '')
{
$this->options[Convert::toConstant($options, 'CURLOPT_')] = $value;
return $this;
}
示例11: layerEffect
public function layerEffect($effect = 'normal')
{
imagelayereffect($this->canvas, Convert::toConstant($effect, 'IMG_EFFECT_'));
return $this;
}