搜索和替换文件或目录的一个好类--很实用
搜索和替换文件或目录的一个好类--很实用,搜索和替换文件或目录的一个好类--很实用
类文件 search_replace.inc
<?php
class search_replace{
var $find;
var $replace;
var $files;
var $directories;
var $include_subdir;
var $ignore_lines;
var $ignore_sep;
var $occurences;
var $search_function;
var $last_error;
//以下进行函数定义和设置
function search_replace($find, $replace, $files, $directories = '', $include_subdir = 1, $ignore_lines = array()){
$this-find = $find;
$this-replace = $replace;
$this-files = $files;
$this-directories = $directories;
$this-include_subdir = $include_subdir;
$this-ignore_lines = $ignore_lines;
$this-occurences = 0;
$this-search_function = 'search';
$this-last_error = '';
}
/***************************************
** Accesso