这是一个linux shell命令,它将在php文件中注释来自某个目录的所有require_once调用:
% cd path/to/ZendFramework/library % find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' \ -not -wholename '*/Application.php' -print0 | \ xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'
但是,我怎么能在Windows操作系统cmd中做到这一点?
这是为了加速Zend Framework应用程序。
编辑:
在一行上:
find . -name '*.php' -not -wholename '*/Loader/Autoloader.php' -not -wholename */Application.php' -print0 | xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'
有了这个和这个 。
仅供参考,在Windows上,由于某种原因,我无法使xargs工作,但这是我通过Git Bash shell运行的命令:
find . -name '*.php' -print0 | xargs -0 sed --regexp-extended --in-place 's/(require_once)/\/\/ \1/g'
然后,手动将Loader.php和Application.php文件重新复制到受约束的文件中。