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


PHP textlib::strrpos方法代码示例

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


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

示例1: test_strrpos

 /**
  * Tests the static strrpos
  * @return void
  */
 public function test_strrpos()
 {
     $str = "Žluťoučký koníček";
     $this->assertSame(textlib::strrpos($str, 'o'), 11);
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:9,代码来源:textlib_test.php

示例2: display_name_from_file

 /**
  * Generate the name of the mod instance from the name of the file
  * (remove the extension and convert underscore => space
  *
  * @param string $filename the filename of the uploaded file
  * @return string the display name to use
  */
 protected function display_name_from_file($filename)
 {
     $pos = textlib::strrpos($filename, '.');
     if ($pos) {
         // Want to skip if $pos === 0 OR $pos === false.
         $filename = textlib::substr($filename, 0, $pos);
     }
     return str_replace('_', ' ', $filename);
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:16,代码来源:dnduploadlib.php

示例3: url_remove_dot_segments

/**
 * Filter out "." and ".." segments from a URL's path and return
 * the result.
 *
 * This function implements the "remove_dot_segments" algorithm from
 * the RFC3986 specification for URLs.
 *
 * This function supports multi-byte characters with the UTF-8 encoding,
 * per the URL specification.
 *
 * Parameters:
 * 	path	the path to filter
 *
 * Return values:
 * 	The filtered path with "." and ".." removed.
 */
function url_remove_dot_segments( $path )
{
	// multi-byte character explode
	$inSegs  = preg_split( '!/!u', $path );
	$outSegs = array( );
	foreach ( $inSegs as $seg )
	{
		if ( $seg == '' || $seg == '.')
			continue;
		if ( $seg == '..' )
			array_pop( $outSegs );
		else
			array_push( $outSegs, $seg );
	}
	$outPath = implode( '/', $outSegs );

	if ($path[0] == '/') {
		$outPath = '/' . $outPath;
	}

	// Compare last multi-byte character against '/'.
	if ($outPath != '/' && (textlib::strlen($path) - 1) == textlib::strrpos($path, '/', 'UTF-8')) {
		$outPath .= '/';
	}
	return $outPath;
}
开发者ID:verbazend,项目名称:AWFA,代码行数:42,代码来源:locallib.php


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