0
我用這個函數----> import_request_variables('p')在超過50個php文件中使用這個函數 - > extract($ _ GET,EXTR_PREFIX_ALL,' p');在那裏,PHP腳本可以做這個工作,而無需打開每個文件用新函數替換許多php文件中不推薦使用的函數
我想是這樣的:
//讀取整個字符串
$str=implode("",file('../*.php'));
$fp=fopen('../*.php','w');
//replace something in the file string, here i am replacing import_request_variables('p') to extract($_GET, EXTR_PREFIX_ALL, 'p')
$str=str_replace('import_request_variables('p')','extract($_GET, EXTR_PREFIX_ALL, 'p')',$str);
//now, save the file
fwrite($fp,$str,strlen($str));
爲什麼不使用某些IDE重構功能? –