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


PHP mb_strrchr函数代码示例

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


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

示例1: __construct

 public function __construct($https = false)
 {
     $root = mb_strrchr($_SERVER['PHP_SELF'], '/', true);
     if (isset($_SERVER['HTTPS']) || $https) {
         $prefix = 'https://';
     } else {
         $prefix = 'http://';
     }
     $this->setBaseUri($prefix . $_SERVER['HTTP_HOST'] . $root);
     $aPageParams = explode('/', $_SERVER['QUERY_STRING'], 2048);
     $this->setPage(array_shift($aPageParams));
     $tmpParamsObj = new stdClass();
     while (count($aPageParams)) {
         $sKey = strip_tags(rawurldecode(array_shift($aPageParams)));
         $sValue = strip_tags(rawurldecode(array_shift($aPageParams)));
         if (empty($sKey)) {
             continue;
         }
         if (strstr($sValue, ',')) {
             $sValue = explode(',', $sValue, 2048);
         }
         $tmpParamsObj->{$sKey} = $sValue;
     }
     $this->setPageParams($tmpParamsObj);
 }
开发者ID:jramstedt,项目名称:AVM,代码行数:25,代码来源:Url.class.php

示例2: uploadFile

	/**
	 * Copy an image uploaded with HTML form to the specified directory.
	 * In view scripts one should use something like <img src="{$fileBaseDir}/{@return}"/>
	 *
	 * @param string $paramName Parameter name as it passed by a form.
	 * @param string $fileBaseDir A base directory constant for the file (should be used in view scripts as prefix before $filePath from DB table).
	 * @return string New file's name.
	 * @throws CException 
	 */
	public static function uploadFile($paramName, $fileBaseDir)
	{
		if(empty($_FILES[AutoAdmin::INPUT_PREFIX]['tmp_name'][$paramName]) || !empty($_FILES[AutoAdmin::INPUT_PREFIX]['error'][$paramName]))
			throw new AAException(Yii::t('AutoAdmin.errors', 'An error occured with uploading of the file for field "{field}"', array('{field}'=>$paramName)));
		$uploadedFileName =& $_FILES[AutoAdmin::INPUT_PREFIX]['name'][$paramName];

		$newfname = '';
		$toDir = self::srcToPath($fileBaseDir);
		$newfname = mb_strtolower(mb_substr($uploadedFileName, 0, mb_strrpos($uploadedFileName, '.')));
		$newfname = AAHelperText::translite($newfname);
		$newfname = str_replace(' ', '_', $newfname);
		$newfname = preg_replace('/[^a-z\-\_0-9]/ui', '', $newfname);
		if(mb_strlen($newfname)>60)
			$newfname = mb_substr($newfname, 0, 60);
		$ext = mb_substr(mb_strrchr($uploadedFileName, '.'), 1);
		if(!is_dir($toDir))
		{
			if(!mkdir($toDir, 0777, true))
				throw new AAException(Yii::t('AutoAdmin.errors', 'The directory "{dirname}" cannot be created', array('{dirname}'=>$toDir)));
		}
		while(file_exists($toDir.DIRECTORY_SEPARATOR.$newfname.'.'.$ext))
			$newfname .= '_'.rand(0, 9);
		$newfname .= ".{$ext}";
		if(!copy($_FILES[AutoAdmin::INPUT_PREFIX]['tmp_name'][$paramName], $toDir.DIRECTORY_SEPARATOR.$newfname))
			throw new AAException(Yii::t('AutoAdmin.errors', 'The file ({filename}) cannot be copied', array('{filename}'=>$newfname)));
		return $newfname;
	}
开发者ID:nico13051995,项目名称:IntITA,代码行数:36,代码来源:AAHelperFile.php

示例3: copyImage

	function copyImage($var, $uploadDir='/i/other')
	{
		$newFileName = '';
		$newFileName = mb_strtolower(mb_substr($_FILES[$var]['name'], 0, mb_strrpos($_FILES[$var]['name'], '.')));
		$newFileName = AAHelperText::translite($newFileName);
		$newFileName = str_replace(' ', '_', $newFileName);
		$newFileName = preg_replace('/[^a-z\-\_0-9]/ui', '', $newFileName);
		if(mb_strlen($newFileName)>60)
			$newFileName = mb_substr($newFileName, 0, 60);
		$ext = mb_strrchr($_FILES[$var]['name'], '.');
		$newFileName .= $ext;
		$fileLinkDir = $uploadDir;
		$targetPath = Yii::app()->basePath.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.Yii::app()->modules['autoadmin']['wwwDirName'].str_replace('/', DIRECTORY_SEPARATOR, $uploadDir);
		if(!is_dir($targetPath))
		{
			if(!mkdir($targetPath))
				throw new CHttpException(406, "Указанная в настройках директория [{$fileLinkDir}] не существует и не может быть создана.");
		}
		$targetPath .= DIRECTORY_SEPARATOR.$newFileName;
		if(!copy($_FILES[$var]['tmp_name'], $targetPath))
			throw new CHttpException(406, "Файл невозможно сохранить в указанной в настройках директории [{$fileLinkDir}]. Вероятнее всего, проблемы с правами.");
		if(!getimagesize($targetPath))
		{
			throw new CHttpException(406, "Загружаемый файл не является изображением допустимого формата.");
		}
		return $fileLinkDir.'/'.$newFileName;
	}
开发者ID:nico13051995,项目名称:IntITA,代码行数:27,代码来源:AAFileController.php

示例4: strrchr

 /**
  * Метод возвращает последнее вхождение символа в строке
  *
  * @param string $string
  * @param string $charset
  * @return string
  *
  * @version 0.1 21.08.2011
  * @since 0.1
  * @author webmaxx <webmaxx@webmaxx.name>
  */
 public function strrchr($string, $charset = 'UTF-8')
 {
     if ($this->_functionExists('mb_strrchr')) {
         return mb_strrchr($string, $charset);
     } else {
         return strrchr($string);
     }
 }
开发者ID:Aplay,项目名称:anetika_site,代码行数:19,代码来源:MString.php

示例5: PMA_languageName

/**
 * Returns language name
 *
 * @param string $tmplang Language code
 *
 * @return string
 */
function PMA_languageName($tmplang)
{
    $lang_name = ucfirst(mb_substr(mb_strrchr($tmplang[0], '|'), 1));
    // Include native name if non empty
    if (!empty($tmplang[2])) {
        $lang_name = $tmplang[2] . ' - ' . $lang_name;
    }
    return $lang_name;
}
开发者ID:graurus,项目名称:testgit_t37,代码行数:16,代码来源:select_lang.lib.php

示例6: buildDescription2

 protected function buildDescription2($data)
 {
     if (!$this->ga_description2) {
         $text = "{KEYWORD:{$data}}";
         if (strlen($text) > 35) {
             if (mb_strlen($data, 'utf-8') > 25) {
                 $tmp = mb_substr($data, 0, 25, 'utf-8');
                 $tmp2 = mb_strrchr($tmp, ' ', true, 'utf-8');
                 $text = "{KEYWORD:" . mb_substr($data, 0, mb_strlen($tmp2, 'utf-8'), 'utf-8') . "}";
             }
         }
         $this->setDescription2($text);
     }
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:14,代码来源:GoogleAdVehiclesWeHaveMoreIL.php

示例7: createCommand

 /**
  * Creates a DB command that can be used to execute this query.
  *
  * @param Connection $db the DB connection used to create the DB command.
  *                       If null, the DB connection returned by [[modelClass]] will be used.
  *
  * @return Command the created DB command instance.
  */
 public function createCommand($db = null)
 {
     /** @type ActiveRecord $modelClass */
     $modelClass = $this->modelClass;
     if ($db === null) {
         $db = $modelClass::getDb();
     }
     if ($this->from === null) {
         $this->from = $modelClass::modelName();
     }
     if ($this->searchModel === null) {
         $this->searchModel = mb_substr(mb_strrchr($this->modelClass, '\\'), 1) . 'Search';
     }
     return parent::createCommand($db);
 }
开发者ID:apexwire,项目名称:yii2-restclient,代码行数:23,代码来源:RestQuery.php

示例8: printValue

	public function printValue()
	{
		if($this->value)
		{
			$ext = mb_substr(mb_strrchr($this->value, '.'), 1);
			if(!$ext)
				$ext = '';
			$spanOptions = array('class'=>'file'.($ext ? " ext-{$ext}" : ''));
			if(in_array($ext, array('jpg', 'gif', 'png')))
				return CHtml::link($this->value, "{$this->options['directoryPath']}/{$this->value}", $spanOptions);
			else
				return CHtml::tag('span', $spanOptions, $this->value);
		}
		else
			return null;
	}
开发者ID:nico13051995,项目名称:IntITA,代码行数:16,代码来源:AAFieldFile.php

示例9: find

 function find($needle, $ignoreCase = false, $reverse = false)
 {
     if ($ignoreCase) {
         if ($reverse) {
             $this->__invar = mb_strrichr($this->__invar, $needle);
         } else {
             $this->__invar = mb_stristr($this->__invar, $needle);
         }
     } else {
         if ($reverse) {
             $this->__invar = mb_strrchr($this->__invar, $needle);
         } else {
             $this->__invar = mb_strstr($this->__invar, $needle);
         }
     }
     return $this;
 }
开发者ID:rainlethe,项目名称:self,代码行数:17,代码来源:FromString.php

示例10: buildHeadline

 protected function buildHeadline($data, $params)
 {
     if (mb_strlen($data, 'utf-8') > 25) {
         if (mb_strlen($data, 'utf-8') > 35) {
             $tmp = mb_substr($data, 0, 35, 'utf-8');
             $tmp2 = mb_strrchr($tmp, ' ', true, 'utf-8');
             $tmp2 = preg_replace("![0-9 ]+\$!", "", $tmp2);
         } else {
             $tmp2 = $data;
         }
         $this->setDescription1($tmp2);
         $this->setDescription2(mb_substr($text, mb_strlen($tmp2, 'utf-8')), 35, 'utf-8');
         $text = 'מחפשים ' . $params[0]['l_make'] . " " . $params[0]['l_model'];
         $this->setHeadline($text . "?");
     } else {
         $this->setHeadline($data);
     }
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:18,代码来源:GoogleAdVehiclesMinPriceIL.php

示例11: buildHeadline

 protected function buildHeadline($data, $params)
 {
     if (mb_strlen($data, 'utf-8') > 25) {
         if (mb_strlen($data, 'utf-8') > 35) {
             $tmp = mb_substr($data, 0, 35, 'utf-8');
             $tmp2 = mb_strrchr($tmp, ' ', true, 'utf-8');
             $tmp2 = preg_replace("![0-9 ]+\$!", "", $tmp2);
         } else {
             $tmp2 = $data;
         }
         $this->setDescription1($tmp2);
         $this->setDescription2(mb_substr($text, mb_strlen($tmp2, 'utf-8')), 35, 'utf-8');
         $text = 'מחפשים ' . $params['l_assetType'];
         if (mb_strlen($text . ($params['l_geo_city'] ? " ב" . $params['l_geo_city'] : ""), 'utf-8') < 26) {
             $text .= $params['l_geo_city'] ? " ב" . $params['l_geo_city'] : "";
         }
         $this->setHeadline($text . "?");
     } else {
         $this->setHeadline($data);
     }
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:21,代码来源:GoogleAdRealEstateMinPriceIL.php

示例12: PortalNotesFiles

function PortalNotesFiles($file, &$PortalNotesFilesError)
{
    global $PortalNotesFilesPath;
    if (!$file || !is_uploaded_file($file['tmp_name'])) {
        //no file uploaded
        $PortalNotesFilesError = _('File not uploaded');
    }
    //Check the post_max_size & php_value upload_max_filesize values in the php.ini file
    //extensions white list
    $white_list = array('.doc', '.docx', '.txt', '.pdf', '.xls', '.xlsx', '.csv', '.jpg', '.jpeg', '.png', '.gif', '.zip', '.ppt', '.pptx', '.mp3', '.wav', '.avi', '.mp4', '.ogg');
    if (!in_array(mb_strtolower(mb_strrchr($file['name'], '.')), $white_list)) {
        $PortalNotesFilesError = _('Unauthorized file attached extension') . ': ' . mb_strtolower(mb_strrchr($file['name'], '.'));
    }
    if ($file['size'] > 10240000) {
        // file size must be < 10Mb
        $PortalNotesFilesError = _('File attached size') . ' > 10Mb: ' . $file['size'] / 1024 / 1024 . 'Mb';
    }
    //if current sYear folder doesnt exist, create it!
    if (!is_dir($PortalNotesFilesPath)) {
        if (!mkdir($PortalNotesFilesPath)) {
            $PortalNotesFilesError = _('Folder not created') . ': ' . $PortalNotesFilesPath;
        }
    }
    if (!is_writable($PortalNotesFilesPath)) {
        $PortalNotesFilesError = _('Folder not writable') . ': ' . $PortalNotesFilesPath;
    }
    //see PHP user rights
    if (!empty($PortalNotesFilesError)) {
        return '';
    }
    //store file
    $file_name = str_replace(' ', '_', trim($file['name']));
    //sanitize name
    $file_name = no_accents($file_name);
    $new_file = $PortalNotesFilesPath . $file_name;
    if (move_uploaded_file($file['tmp_name'], $new_file)) {
        return $new_file;
    }
    return '';
}
开发者ID:fabioassuncao,项目名称:rosariosis,代码行数:40,代码来源:PortalNotesFiles.inc.php

示例13: __invoke

 /**
  * File extension.
  *
  * @since 150424 Initial release.
  *
  * @param string $path A filesystem path.
  *
  * @return string File extension; or empty string.
  */
 public function __invoke(string $path) : string
 {
     if (!$path) {
         return '';
         // Not possible.
     }
     if (mb_substr($path, -1) === '/') {
         return '';
         // Directory.
     }
     if (!($basename = basename($path))) {
         return '';
         // Nothing.
     }
     if (!($ext = mb_strrchr($basename, '.'))) {
         return '';
         // Nothing.
     }
     $ext = $this->c::mbLTrim($ext, '.');
     $ext = mb_strtolower($ext);
     return $ext;
 }
开发者ID:websharks,项目名称:core,代码行数:31,代码来源:FileExt.php

示例14: whoCalledMe

 public static function whoCalledMe($deep = 1, $back = 0)
 {
     ob_start();
     debug_print_backtrace();
     $infos = ob_get_contents();
     ob_end_clean();
     $id = '#' . ++$deep;
     $entry = str_replace(mb_strstr($infos, $id), "", $infos);
     if (!$entry) {
         $entry = $infos;
     }
     $it_was_me = mb_strrchr(mb_strrchr($entry, '#'), '/');
     $it_was_me = explode(':', mb_substr($it_was_me, 1, -2));
     if (!empty($it_was_me[0])) {
         return $it_was_me;
     } else {
         if ($back > 0) {
             return self::whoCalledMe(++$deep, --$back);
         } else {
             return array();
         }
     }
 }
开发者ID:Nivl,项目名称:Ninaca_1,代码行数:23,代码来源:Misc.class.php

示例15: ext

 /**
  * Get the extension.
  *
  * @access public
  * @param string $file
  * @return string
  * @static
  */
 public static function ext($file)
 {
     return mb_strtolower(trim(mb_strrchr($file, '.'), '.'));
 }
开发者ID:xstation1021,项目名称:kdkitchen,代码行数:12,代码来源:Uploader.php


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