让grep搜索所有文件夹?

I have code that will grep through all files in a cpanel but am unsure what arguments to use in the shell command.

Currently this is the line of code going into shell_exec(): $command = "grep -il '.$term.' ./*";

This is only searching the files in the folder that this script is in. Adding the -r argument does not fix it nor does -d recursive.

find . -exec grep -il '.$term.' {} \;

The '\' may be unnecessary on windows machines but will be necessary on *nix

grep -r "some string" <dir>

This will recursively search all directories below dir

Hope it helps.