文件操作 - Strings.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/the-events-calendar/common/src/Tribe/Utils/Strings.php
编辑文件内容
<?php /** * String Utilities * * @since 4.12.1 * @package Tribe\Utils */ namespace Tribe\Utils; /** * Class Strings * * @since 4.12.1 * * @package Tribe\Utils */ class Strings { /** * Replace the first occurrence of a given value in the string. * * @since 4.12.1 * * @param string $search The string to search for and replace. * @param string $replace The replacement string. * @param string $subject The string to do the search and replace from. * * @return string The string with the first occurrence of a given value replaced. */ public static function replace_first( $search, $replace, $subject ) { if ( '' === $search ) { return $subject; } $position = strpos( $subject, $search ); if ( $position !== false ) { return substr_replace( $subject, $replace, $position, strlen( $search ) ); } return $subject; } /** * Replace the last occurrence of a given value in the string. * * @since 4.12.1 * * @param string $search The string to search for and replace. * @param string $replace The replacement string. * @param string $subject The string to do the search and replace from. * * @return string The string with the last occurrence of a given value replaced. */ public static function replace_last( $search, $replace, $subject ) { $position = strrpos( $subject, $search ); if ( $position !== false ) { return substr_replace( $subject, $replace, $position, strlen( $search ) ); } return $subject; } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件