當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。