本文整理汇总了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);
}
示例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);
}
示例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;
}